Skip to content

Commit

Permalink
fixup! feat(compiler): copy dock block from component to generated types
Browse files Browse the repository at this point in the history
  • Loading branch information
jgroth authored and alicewriteswrongs committed Dec 1, 2022
1 parent 04d7731 commit f0b2d37
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/compiler/types/generate-app-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ const generateComponentTypesFile = (config: d.Config, buildCtx: d.BuildCtx, areT
c.push(`}`);

c.push(`declare namespace LocalJSX {`);
c.push(...modules.map((m) => ` ${m.jsx}`));
c.push(
...modules.map((m) => {
const docs = components.find((c) => c.tagName === m.tagName).docs;
return addDocBlock(` ${m.jsx}`, docs, 4);
})
);

c.push(` interface IntrinsicElements {`);
c.push(...modules.map((m) => ` "${m.tagName}": ${m.tagNameAsPascal};`));
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/types/generate-component-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const generateComponentTypes = (
tagNameAsPascal,
htmlElementName,
component: addDocBlock(` interface ${tagNameAsPascal} {\n${componentAttributes} }`, cmp.docs, 4),
jsx: addDocBlock(` interface ${tagNameAsPascal} {\n${jsxAttributes} }`, cmp.docs, 2),
jsx: ` interface ${tagNameAsPascal} {\n${jsxAttributes} }`,
element: element.join(`\n`),
};
};
Expand Down
7 changes: 3 additions & 4 deletions test/karma/test-app/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1497,10 +1497,9 @@ declare namespace LocalJSX {
interface ShadowDomBasicRoot {
}
/**
*
* @virtualProp {string} colormode - The mode determines which platform styles to use.
*/
interface ShadowDomMode {
* @virtualProp {string} colormode - The mode determines which platform styles to use.
*/
interface ShadowDomMode {
/**
* The mode determines which platform styles to use.
*/
Expand Down

0 comments on commit f0b2d37

Please sign in to comment.