primitiveTypeConstructs now uses Object.assign() instead of the deleted function src/util/object-assign.ts which expects a plain object, but the TypeScript type still expects a function. This has a large effect on my codebase because I am using onCreateComponent to identify a very specific situation where a type needed an override, and then primitiveTypeConstructs to define that type.
This happened in PR #1562
Type still states: primitiveTypeConstructs?: (struct: PrimitiveTypeStruct) => Partial<PrimitiveTypeStruct>
Runtime expects: primitiveTypeConstructs?: Partial<PrimitiveTypeStruct>
I am able to move forward with the following change, but it should have been called out -anywhere- before the release was published, and the type definitions need to be fixed.
Previous (no longer does anything):
generateApi({
primitiveTypeConstructs: (constructs) => {
return {
...constructs, // <-- these spreads were previously required to make this work, I don't remember why
string: {
...(constructs.string), // <-- some extra type overrides were here to make errors go away
$default: () => 'string',
FeatureFlag: () => 'FeatureFlag',
},
}
},
// [...etc]
})
Working:
generateApi({
primitiveTypeConstructs: {
string: {
$default: 'string', // <-- this has to be present in the object or else i get a crash during generation
FeatureFlag: 'FeatureFlag',
},
},
// [...etc]
})
primitiveTypeConstructsnow uses Object.assign() instead of the deleted function src/util/object-assign.tswhich expects a plain object, but the TypeScript type still expects a function. This has a large effect on my codebase because I am usingonCreateComponentto identify a very specific situation where a type needed an override, and thenprimitiveTypeConstructsto define that type.This happened in PR #1562
Type still states:
primitiveTypeConstructs?: (struct: PrimitiveTypeStruct) => Partial<PrimitiveTypeStruct>Runtime expects:
primitiveTypeConstructs?: Partial<PrimitiveTypeStruct>I am able to move forward with the following change, but it should have been called out -anywhere- before the release was published, and the type definitions need to be fixed.
Previous (no longer does anything):
Working: