Closed humphd closed 1 month ago
Hey @humphd can you give me an example of the code where you are getting this error?
The cache = {}
cannot be type { [key: string]: any }
, I define it as a dynamic object to allow typescript to translate into a namespace structure.
Example:
const cache = {}
cache.schema0 = Type.String()
cache.schema1 = Type.Number()
Typescript translate this into:
import * as _sinclair_typebox from '@sinclair/typebox';
type TSchema = _sinclair_typebox.TSchema;
type Static<T extends TSchema> = _sinclair_typebox.Static<T>;
declare namespace cache {
let schema0: _sinclair_typebox.TString;
let schema1: _sinclair_typebox.TNumber;
}
latest version remove the cache object
This may not be something you want to address, but I'm trying to use the generated file in TypeScript. That mostly works, but one thing that breaks is:
TypeScript is unhappy with this due to the keys:
In my code I'm switching it to this, which side-steps it: