* check defaults. If the default object is an object literal with only * static properties, we can directly generate more optimized default * declarations. Otherwise we will have to fallback to runtime merging.
(ctx: TypeResolveContext)
| 318 | * declarations. Otherwise we will have to fallback to runtime merging. |
| 319 | */ |
| 320 | function hasStaticWithDefaults(ctx: TypeResolveContext) { |
| 321 | return !!( |
| 322 | ctx.propsRuntimeDefaults && |
| 323 | ctx.propsRuntimeDefaults.type === 'ObjectExpression' && |
| 324 | ctx.propsRuntimeDefaults.properties.every( |
| 325 | node => |
| 326 | node.type !== 'SpreadElement' && |
| 327 | (!node.computed || node.key.type.endsWith('Literal')), |
| 328 | ) |
| 329 | ) |
| 330 | } |
| 331 | |
| 332 | function genDestructuredDefaultValue( |
| 333 | ctx: TypeResolveContext, |
no test coverage detected