@@ -136,11 +136,11 @@ export interface ImportBinding {
136
136
isUsedInTemplate : boolean
137
137
}
138
138
139
- type FromNormalScript = { __fromNormalScript ?: boolean }
140
-
141
- type PropsDeclType = ( TSTypeLiteral | TSInterfaceBody ) & FromNormalScript
142
-
143
- type EmitsDeclType = ( TSFunctionType | TSTypeLiteral | TSInterfaceBody ) & FromNormalScript
139
+ type FromNormalScript < T > = T & { __fromNormalScript ?: boolean | null }
140
+ type PropsDeclType = FromNormalScript < TSTypeLiteral | TSInterfaceBody >
141
+ type EmitsDeclType = FromNormalScript <
142
+ TSFunctionType | TSTypeLiteral | TSInterfaceBody
143
+ >
144
144
145
145
/**
146
146
* Compile `<script setup>`
@@ -669,7 +669,7 @@ export function compileScript(
669
669
function resolveQualifiedType (
670
670
node : Node ,
671
671
qualifier : ( node : Node ) => boolean
672
- ) : ( Node & FromNormalScript ) | undefined {
672
+ ) : Node | undefined {
673
673
if ( qualifier ( node ) ) {
674
674
return node
675
675
}
@@ -693,7 +693,7 @@ export function compileScript(
693
693
filterExtendsType ( extendsTypes , bodies )
694
694
qualified . body = bodies
695
695
}
696
- ; ( qualified as Node & FromNormalScript ) . __fromNormalScript =
696
+ ; ( qualified as FromNormalScript < Node > ) . __fromNormalScript =
697
697
scriptAst && i >= scriptSetupAst . body . length
698
698
return qualified
699
699
}
@@ -1486,7 +1486,9 @@ export function compileScript(
1486
1486
if ( destructureElements . length ) {
1487
1487
args += `, { ${ destructureElements . join ( ', ' ) } }`
1488
1488
if ( emitsTypeDecl ) {
1489
- const content = emitsTypeDecl . __fromNormalScript ? script ! . content : scriptSetup . content
1489
+ const content = emitsTypeDecl . __fromNormalScript
1490
+ ? script ! . content
1491
+ : scriptSetup . content
1490
1492
args += `: { emit: (${ content . slice (
1491
1493
emitsTypeDecl . start ! ,
1492
1494
emitsTypeDecl . end !
0 commit comments