@@ -20,6 +20,7 @@ export interface AddComponentExportPara {
2020 componentDocumentation : ComponentDocumentation ;
2121 mode : 'ts' | 'dts' | 'tsx' ;
2222 generics : Generics ;
23+ noSvelteComponentTyped ?: boolean ;
2324}
2425
2526/**
@@ -45,7 +46,8 @@ function addGenericsComponentExport({
4546 mode,
4647 usesAccessors,
4748 str,
48- generics
49+ generics,
50+ noSvelteComponentTyped
4951} : AddComponentExportPara ) {
5052 const genericsDef = generics . toDefinitionString ( ) ;
5153 const genericsRef = generics . toReferencesString ( ) ;
@@ -71,20 +73,24 @@ class __sveltets_Render${genericsDef} {
7173}
7274` ;
7375
76+ const svelteComponentClass = noSvelteComponentTyped
77+ ? 'SvelteComponent'
78+ : 'SvelteComponentTyped' ;
79+
7480 if ( mode === 'dts' ) {
7581 statement +=
7682 `export type ${ className } Props${ genericsDef } = ${ returnType ( 'props' ) } ;\n` +
7783 `export type ${ className } Events${ genericsDef } = ${ returnType ( 'events' ) } ;\n` +
7884 `export type ${ className } Slots${ genericsDef } = ${ returnType ( 'slots' ) } ;\n` +
7985 `\n${ doc } export default class${
8086 className ? ` ${ className } ` : ''
81- } ${ genericsDef } extends SvelteComponentTyped <${ className } Props${ genericsRef } , ${ className } Events${ genericsRef } , ${ className } Slots${ genericsRef } > {` +
87+ } ${ genericsDef } extends ${ svelteComponentClass } <${ className } Props${ genericsRef } , ${ className } Events${ genericsRef } , ${ className } Slots${ genericsRef } > {` +
8288 exportedNames . createClassGetters ( ) +
8389 ( usesAccessors ? exportedNames . createClassAccessors ( ) : '' ) +
8490 '\n}' ;
8591 } else {
8692 statement +=
87- ' \n\nimport { SvelteComponentTyped as __SvelteComponentTyped__ } from "svelte" \n' +
93+ ` \n\nimport { ${ svelteComponentClass } as __SvelteComponentTyped__ } from "svelte" \n` +
8894 `${ doc } export default class${
8995 className ? ` ${ className } ` : ''
9096 } ${ genericsDef } extends __SvelteComponentTyped__<${ returnType ( 'props' ) } , ${ returnType (
@@ -107,7 +113,8 @@ function addSimpleComponentExport({
107113 fileName,
108114 mode,
109115 usesAccessors,
110- str
116+ str,
117+ noSvelteComponentTyped
111118} : AddComponentExportPara ) {
112119 const propDef = props (
113120 isTsFile ,
@@ -135,14 +142,18 @@ function addSimpleComponentExport({
135142 return `type ${ replacement } = typeof __propDef.${ type . toLowerCase ( ) } ;\nexport { ${ replacement } as ${ exportName } };\n` ;
136143 } ;
137144
145+ const svelteComponentClass = noSvelteComponentTyped
146+ ? 'SvelteComponent'
147+ : 'SvelteComponentTyped' ;
148+
138149 statement =
139150 `\nconst __propDef = ${ propDef } ;\n` +
140151 addTypeExport ( 'Props' ) +
141152 addTypeExport ( 'Events' ) +
142153 addTypeExport ( 'Slots' ) +
143154 `\n${ doc } export default class${
144155 className ? ` ${ className } ` : ''
145- } extends SvelteComponentTyped <${ className } Props, ${ className } Events, ${ className } Slots> {` +
156+ } extends ${ svelteComponentClass } <${ className } Props, ${ className } Events, ${ className } Slots> {` +
146157 exportedNames . createClassGetters ( ) +
147158 ( usesAccessors ? exportedNames . createClassAccessors ( ) : '' ) +
148159 '\n}' ;
0 commit comments