Closed bdarcus closed 1 year ago
Change format property to templates.
Also, make separate properties for called and inline.
Close: #116
May also want to distinguish templates and namedTemplates (or templateCollection)?
templates
namedTemplates
templateCollection
PS - hard to sort out how to adjust the model to do this! I may have to use types, rather than interfaces, for the templates; something like:
type Context = | Options | Template type Options = { options: string; } type Template = InlineTemplate | CalledTemplate; // instead of extends, use & type RenderList = Options & Template; type InlineTemplate = { template: "InlineTemplate"; } type CalledTemplate = { templateKey: "CalledTemplate"; } const template1: Context = { options: "test", template: "InlineTemplate" }; // valid const template2: Context = { options: "test", templateKey: "CalledTemplate" }; // valid const template1: Context = { options: "test", templateKey: "InlineTemplate" }; // not valid
I don't think you can do that with interfaces.
Unfortunately, in fixing this here, I triggered this long-open bug in the schema-generator:
https://github.com/vega/ts-json-schema-generator/issues/192
Bigger change, while I'm at it, is split style.ts into multiple.
style.ts
Change format property to templates.
Also, make separate properties for called and inline.
Close: #116
May also want to distinguish
templates
andnamedTemplates
(ortemplateCollection
)?PS - hard to sort out how to adjust the model to do this! I may have to use types, rather than interfaces, for the templates; something like:
I don't think you can do that with interfaces.
Unfortunately, in fixing this here, I triggered this long-open bug in the schema-generator:
https://github.com/vega/ts-json-schema-generator/issues/192
Bigger change, while I'm at it, is split
style.ts
into multiple.