Closed danielroe closed 1 year ago
FYI: these were the changes necessary to get migrate Nuxt to the new definition: https://github.com/nuxt/nuxt/pull/22340/commits/6604ed7858b5ea588363fb08aa9f50f008415bc2.
I don't believe these were the result specifically of this change but due to greater strictness in latest TS version.
As well as the changes in this PR, I would suggest we also relax the InputObject
types when used within applyDefaults
and resolveSchema
- ie. at the moment it is asserting that the input object must have a key signature, but I think we should not do so.
Merging #102 (a17175e) into main (347c312) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## main #102 +/- ##
=======================================
Coverage 88.00% 88.00%
=======================================
Files 8 8
Lines 1167 1167
Branches 270 270
=======================================
Hits 1027 1027
Misses 140 140
Files Changed | Coverage Ξ | |
---|---|---|
src/types.ts | 100.00% <100.00%> (ΓΈ) |
π Linked issue
https://github.com/nuxt/nuxt/pull/22340
β Type of change
π Description
We currently have an issue with newer typescript versions whereby
$resolve
(and similar 'magic' keys) are not being typed correctly because they could also be equally well typed withany
. This makes a change to SchemaDefinition types that removes theany
signature in favour of explicitJSValue
types (but only for keys that do not match$resolve
, etc.).This increases type safety and may result in an error when an
unknown
property is assigned to a schema value. But nevertheless this is worth testing to ensure no (unintended) regressions.π Checklist