Closed SiebrenKazemier closed 1 year ago
Isn't there the option to extend a data type using anonymousData
?
types.TitleComponent = anonymousData(object({
type: constant('title'),
title: string(),
subtitle: nillable(string),
}));
// or
types.TitleComponent = object({
type: constant('title'),
title: string(),
subtitle: nillable(string),
}, anonymousData());
should give you
export interface TitleComponent {
type: "title";
name: string;
subtitle?: string;
[k: string]: string;
}
Right?
Problem
There is no option for additional properties on the outer component. Currently, the only option is to use the anonymousData() type. However this always results in:
`export interface BazComponent { type: "baz"; name: string; additionalProps: {
}`
Solution
Add "additionalProperties" to the objectBaseOptions to create objects like:
`export interface BazComponent { type: "baz"; name: string;
}`