MCPcopy
hub / github.com/vuejs/core / hasStaticWithDefaults

Function hasStaticWithDefaults

packages/compiler-sfc/src/script/defineProps.ts:320–330  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

318 * declarations. Otherwise we will have to fallback to runtime merging.
319 */
320function 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
332function genDestructuredDefaultValue(
333 ctx: TypeResolveContext,

Callers 1

extractRuntimePropsFunction · 0.85

Calls 1

everyMethod · 0.80

Tested by

no test coverage detected