type Alias = number[]
- enum Enum { one = '1', two = '2' }
-
export default /*#__PURE__*/_defineComponent({
props: {
symbol: { type: Symbol, required: true },
extract: { type: Number, required: true },
exclude: { type: [Number, Boolean], required: true },
- enum: { type: Object, required: true },
uppercase: { type: String, required: true },
params: { type: Array, required: true },
nonNull: { type: String, required: true },
-return { Enum }
+return { }
}
})"
type Alias = number[]
- enum Enum { one = '1', two = '2' }
-
defineProps<{
string: string
number: number
symbol: symbol
extract: Extract<1 | 2 | boolean, 2>
exclude: Exclude<1 | 2 | boolean, 2>
- enum: Enum
uppercase: Uppercase<'foo'>
params: Parameters<(foo: any) => void>
nonNull: NonNullable<string | null>
expect(content).toMatch(
`exclude: { type: [Number, Boolean], required: true }`
)
- expect(content).toMatch(`enum: { type: Object, required: true }`)
expect(content).toMatch(`uppercase: { type: String, required: true }`)
expect(content).toMatch(`params: { type: Array, required: true }`)
expect(content).toMatch(`nonNull: { type: String, required: true }`)
foo: BindingTypes.PROPS,
uppercase: BindingTypes.PROPS,
params: BindingTypes.PROPS,
- nonNull: BindingTypes.PROPS,
- enum: BindingTypes.PROPS,
- Enum: BindingTypes.LITERAL_CONST
+ nonNull: BindingTypes.PROPS
})
})
if (isTS) {
// move all Type declarations to outer scope
if (
- node.type.startsWith('TS') ||
- (node.type === 'ExportNamedDeclaration' &&
- node.exportKind === 'type') ||
- (node.type === 'VariableDeclaration' && node.declare)
+ (node.type.startsWith('TS') ||
+ (node.type === 'ExportNamedDeclaration' &&
+ node.exportKind === 'type') ||
+ (node.type === 'VariableDeclaration' && node.declare)) &&
+ node.type !== 'TSEnumDeclaration'
) {
recordType(node, declaredTypes)
- if (node.type !== 'TSEnumDeclaration') {
- hoistNode(node)
- }
+ hoistNode(node)
}
}
}
}
function recordType(node: Node, declaredTypes: Record<string, string[]>) {
- if (
- node.type === 'TSInterfaceDeclaration' ||
- node.type === 'TSEnumDeclaration'
- ) {
+ if (node.type === 'TSInterfaceDeclaration') {
declaredTypes[node.id.name] = [`Object`]
} else if (node.type === 'TSTypeAliasDeclaration') {
declaredTypes[node.id.name] = inferRuntimeType(