diff --git a/src/compiler/types/generate-app-types.ts b/src/compiler/types/generate-app-types.ts index b0c1ba2845a9..37063fd30e8d 100644 --- a/src/compiler/types/generate-app-types.ts +++ b/src/compiler/types/generate-app-types.ts @@ -1,4 +1,4 @@ -import { addDockBlock, normalizePath } from '@utils'; +import { addDocBlock, normalizePath } from '@utils'; import { isAbsolute, relative, resolve } from 'path'; import type * as d from '../../declarations'; @@ -150,7 +150,7 @@ const generateComponentTypesFile = (config: d.Config, buildCtx: d.BuildCtx, areT ...modules.map((m) => { const docs = components.find((c) => c.tagName === m.tagName).docs; - return addDockBlock( + return addDocBlock( ` "${m.tagName}": LocalJSX.${m.tagNameAsPascal} & JSXBase.HTMLAttributes<${m.htmlElementName}>;`, docs, 12 diff --git a/src/compiler/types/generate-component-types.ts b/src/compiler/types/generate-component-types.ts index d5ebd1053295..969aef7535cf 100644 --- a/src/compiler/types/generate-component-types.ts +++ b/src/compiler/types/generate-component-types.ts @@ -1,4 +1,4 @@ -import { addDockBlock, dashToPascalCase, sortBy } from '@utils'; +import { addDocBlock, dashToPascalCase, sortBy } from '@utils'; import type * as d from '../../declarations'; import { generateEventTypes } from './generate-event-types'; @@ -34,7 +34,7 @@ export const generateComponentTypes = ( const jsxAttributes = attributesToMultiLineString([...propAttributes, ...eventAttributes], true, areTypesInternal); const element = [ - addDockBlock( + addDocBlock( ` interface ${htmlElementName} extends Components.${tagNameAsPascal}, HTMLStencilElement {`, cmp.docs, 4 @@ -50,8 +50,8 @@ export const generateComponentTypes = ( tagName, tagNameAsPascal, htmlElementName, - component: addDockBlock(` interface ${tagNameAsPascal} {\n${componentAttributes} }`, cmp.docs, 4), - jsx: addDockBlock(` interface ${tagNameAsPascal} {\n${jsxAttributes} }`, cmp.docs, 2), + component: addDocBlock(` interface ${tagNameAsPascal} {\n${componentAttributes} }`, cmp.docs, 4), + jsx: addDocBlock(` interface ${tagNameAsPascal} {\n${jsxAttributes} }`, cmp.docs, 2), element: element.join(`\n`), }; }; diff --git a/src/utils/test/util.spec.ts b/src/utils/test/util.spec.ts index 62fb2de0c417..4b79ffe54ba1 100644 --- a/src/utils/test/util.spec.ts +++ b/src/utils/test/util.spec.ts @@ -214,7 +214,7 @@ describe('util', () => { }); it('adds a doc block to the string', () => { - expect(util.addDockBlock(str, docs)).toEqual(`/** + expect(util.addDocBlock(str, docs)).toEqual(`/** * Lorem ipsum * @deprecated only for testing */ @@ -223,7 +223,7 @@ interface Foo extends Components.Foo, HTMLStencilElement {`); it('indents the doc block correctly', () => { str = ' ' + str; - expect(util.addDockBlock(str, docs, 4)).toEqual(` /** + expect(util.addDocBlock(str, docs, 4)).toEqual(` /** * Lorem ipsum * @deprecated only for testing */ @@ -232,13 +232,13 @@ interface Foo extends Components.Foo, HTMLStencilElement {`); it('excludes the @internal tag', () => { docs.tags.push({ name: 'internal' }); - expect(util.addDockBlock(str, docs).includes('@internal')).toBeFalsy(); + expect(util.addDocBlock(str, docs).includes('@internal')).toBeFalsy(); }); it.each([[null], [undefined], [{ tags: [], text: '' }]])( 'does not add a dock block when docs are empty (%j)', (docs) => { - expect(util.addDockBlock(str, docs)).toEqual(str); + expect(util.addDocBlock(str, docs)).toEqual(str); } ); }); diff --git a/src/utils/util.ts b/src/utils/util.ts index 555a831d041d..4ce829ee4949 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -79,7 +79,7 @@ ${docs.tags * @param indentation number of spaces to indent the block with * @returns the doc block */ -export function addDockBlock(str: string, docs?: d.CompilerJsDoc, indentation: number = 0): string { +export function addDocBlock(str: string, docs?: d.CompilerJsDoc, indentation: number = 0): string { if (!docs) { return str; }