Skip to content

Commit

Permalink
chore: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Jan 18, 2023
1 parent 675791f commit c5e92fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Expand Up @@ -1458,7 +1458,7 @@ exports[`SFC compile <script setup> with TypeScript defineEmits w/ type from nor
export interface Emits { (e: 'foo' | 'bar'): void }

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

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

export default /*#__PURE__*/_defineComponent({
props: {
a: { type: String, required: false, default: \\"a\\" }
a: { type: String, required: false, default: "a" }
},
setup(__props: any, { expose }) {
expose();

const props = __props as { a: string }
const props = __props as { a: string };



Expand Down
15 changes: 7 additions & 8 deletions packages/compiler-sfc/src/compileScript.ts
Expand Up @@ -136,12 +136,11 @@ export interface ImportBinding {
isUsedInTemplate: boolean
}

type FromNormalScript = { __fromNormalScript?: boolean }

type PropsDeclType = (TSTypeLiteral | TSInterfaceBody) & FromNormalScript

type EmitsDeclType = (TSFunctionType | TSTypeLiteral | TSInterfaceBody) &
FromNormalScript
type FromNormalScript<T> = T & { __fromNormalScript?: boolean | null }
type PropsDeclType = FromNormalScript<TSTypeLiteral | TSInterfaceBody>
type EmitsDeclType = FromNormalScript<
TSFunctionType | TSTypeLiteral | TSInterfaceBody
>

/**
* Compile `<script setup>`
Expand Down Expand Up @@ -670,7 +669,7 @@ export function compileScript(
function resolveQualifiedType(
node: Node,
qualifier: (node: Node) => boolean
): (Node & FromNormalScript) | undefined {
): Node | undefined {
if (qualifier(node)) {
return node
}
Expand All @@ -694,7 +693,7 @@ export function compileScript(
filterExtendsType(extendsTypes, bodies)
qualified.body = bodies
}
;(qualified as Node & FromNormalScript).__fromNormalScript =
;(qualified as FromNormalScript<Node>).__fromNormalScript =
scriptAst && i >= scriptSetupAst.body.length
return qualified
}
Expand Down

0 comments on commit c5e92fc

Please sign in to comment.