|
@@ -685,13 +685,20 @@ export function compileScript(
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const { type, required } = props[key]
|
|
|
if (!isProd) {
|
|
if (!isProd) {
|
|
|
- const { type, required } = props[key]
|
|
|
|
|
return `${key}: { type: ${toRuntimeTypeString(
|
|
return `${key}: { type: ${toRuntimeTypeString(
|
|
|
type
|
|
type
|
|
|
)}, required: ${required}${
|
|
)}, required: ${required}${
|
|
|
defaultString ? `, ${defaultString}` : ``
|
|
defaultString ? `, ${defaultString}` : ``
|
|
|
} }`
|
|
} }`
|
|
|
|
|
+ } else if (type.indexOf('Boolean') > -1) {
|
|
|
|
|
+ // production: if boolean exists, should keep the type.
|
|
|
|
|
+ return `${key}: { type: ${toRuntimeTypeString(
|
|
|
|
|
+ type
|
|
|
|
|
+ )}${
|
|
|
|
|
+ defaultString ? `, ${defaultString}` : ``
|
|
|
|
|
+ } }`
|
|
|
} else {
|
|
} else {
|
|
|
// production: checks are useless
|
|
// production: checks are useless
|
|
|
return `${key}: ${defaultString ? `{ ${defaultString} }` : 'null'}`
|
|
return `${key}: ${defaultString ? `{ ${defaultString} }` : 'null'}`
|
|
@@ -1621,15 +1628,13 @@ function extractRuntimeProps(
|
|
|
m.key.type === 'Identifier'
|
|
m.key.type === 'Identifier'
|
|
|
) {
|
|
) {
|
|
|
let type
|
|
let type
|
|
|
- if (!isProd) {
|
|
|
|
|
- if (m.type === 'TSMethodSignature') {
|
|
|
|
|
- type = ['Function']
|
|
|
|
|
- } else if (m.typeAnnotation) {
|
|
|
|
|
- type = inferRuntimeType(
|
|
|
|
|
- m.typeAnnotation.typeAnnotation,
|
|
|
|
|
- declaredTypes
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (m.type === 'TSMethodSignature') {
|
|
|
|
|
+ type = ['Function']
|
|
|
|
|
+ } else if (m.typeAnnotation) {
|
|
|
|
|
+ type = inferRuntimeType(
|
|
|
|
|
+ m.typeAnnotation.typeAnnotation,
|
|
|
|
|
+ declaredTypes
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
props[m.key.name] = {
|
|
props[m.key.name] = {
|
|
|
key: m.key.name,
|
|
key: m.key.name,
|