Skip to content

Commit

Permalink
feat: add warning when value and default are both given in one pr…
Browse files Browse the repository at this point in the history
…operty (#66)
  • Loading branch information
LastLeaf committed Sep 8, 2023
1 parent 6782da5 commit 510f88d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions glass-easel/src/behavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,10 @@ export class Behavior<
else if (type === NormalizedPropertyType.Boolean) value = false
else if (type === NormalizedPropertyType.Array) value = []
else value = null
} else if (propDef.default !== undefined) {
triggerWarning(
`the initial value of property "${name}" is not used when its default is provided (when preparing behavior "${is}").`,
)
}
let observer: ((newValue: any, oldValue: any) => void) | null
if (typeof propDef.observer === 'function') {
Expand Down

0 comments on commit 510f88d

Please sign in to comment.