Skip to content

Commit c5e92fc

Browse files
committed
chore: rebase
1 parent 675791f commit c5e92fc

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap

+3-3
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ exports[`SFC compile <script setup> with TypeScript defineEmits w/ type from nor
14581458
export interface Emits { (e: 'foo' | 'bar'): void }
14591459

14601460
export default /*#__PURE__*/_defineComponent({
1461-
emits: [\\"foo\\", \\"bar\\"],
1461+
emits: ["foo", "bar"],
14621462
setup(__props, { expose, emit }: { emit: ({ (e: 'foo' | 'bar'): void }), expose: any, slots: any, attrs: any }) {
14631463
expose();
14641464

@@ -1791,12 +1791,12 @@ exports[`SFC compile <script setup> with TypeScript withDefaults (static) + norm
17911791

17921792
export default /*#__PURE__*/_defineComponent({
17931793
props: {
1794-
a: { type: String, required: false, default: \\"a\\" }
1794+
a: { type: String, required: false, default: "a" }
17951795
},
17961796
setup(__props: any, { expose }) {
17971797
expose();
17981798

1799-
const props = __props as { a: string }
1799+
const props = __props as { a: string };
18001800

18011801

18021802

packages/compiler-sfc/src/compileScript.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,11 @@ export interface ImportBinding {
136136
isUsedInTemplate: boolean
137137
}
138138

139-
type FromNormalScript = { __fromNormalScript?: boolean }
140-
141-
type PropsDeclType = (TSTypeLiteral | TSInterfaceBody) & FromNormalScript
142-
143-
type EmitsDeclType = (TSFunctionType | TSTypeLiteral | TSInterfaceBody) &
144-
FromNormalScript
139+
type FromNormalScript<T> = T & { __fromNormalScript?: boolean | null }
140+
type PropsDeclType = FromNormalScript<TSTypeLiteral | TSInterfaceBody>
141+
type EmitsDeclType = FromNormalScript<
142+
TSFunctionType | TSTypeLiteral | TSInterfaceBody
143+
>
145144

146145
/**
147146
* Compile `<script setup>`
@@ -670,7 +669,7 @@ export function compileScript(
670669
function resolveQualifiedType(
671670
node: Node,
672671
qualifier: (node: Node) => boolean
673-
): (Node & FromNormalScript) | undefined {
672+
): Node | undefined {
674673
if (qualifier(node)) {
675674
return node
676675
}
@@ -694,7 +693,7 @@ export function compileScript(
694693
filterExtendsType(extendsTypes, bodies)
695694
qualified.body = bodies
696695
}
697-
;(qualified as Node & FromNormalScript).__fromNormalScript =
696+
;(qualified as FromNormalScript<Node>).__fromNormalScript =
698697
scriptAst && i >= scriptSetupAst.body.length
699698
return qualified
700699
}

0 commit comments

Comments
 (0)