core-types-ts is a utility package designed to facilitate the conversion of type definitions between the generic `core-types` document format and TypeScript interfaces/types. Currently at stable version 4.1.0, it experiences a consistent release cadence with frequent minor/patch updates and major versions driven by significant feature additions or breaking changes. While not typically used directly by end-users, it serves as a foundational component for higher-level type conversion tools like `typeconv`, which leverages it to transform types between TypeScript, JSON Schema, and GraphQL. Its key differentiator lies in providing a robust, programmatic interface for translating a simplified, JSON-compatible type system (`core-types`) into precise TypeScript declarations, including support for advanced features like namespaces, utility types (Pick, Omit, Partial), and interface heritage.
npm install core-types-tsVerified import paths — ran on the pinned version, not inferred.
Demonstrates converting both from a `core-types` document to TypeScript source code and vice-versa, showcasing basic usage and option passing for each direction.
Migrate all imports to ESM `import` statements. Ensure your project is configured for ESM, e.g., by setting `"type": "module"` in `package.json` or using `.mjs` file extensions.
Upgrade your Node.js runtime to version 14.13.1 or newer (or 16.0.0 or newer). The package explicitly requires `'>=14.13.1 || >=16.0.0'`.
Review the `core-types-ts` v2.0.0 release notes and your code for compatibility with TypeScript 4.6. Update API calls as necessary according to the new signatures.
Consider if `typeconv` (for broader schema conversions) or other specialized tools better fit your use case, as they abstract away direct interaction with `core-types-ts`.
Ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`) and use `import` statements. If trying to `require()`, switch to `import`.
Verify that both your consuming code and `core-types-ts` are consistently treated as ESM modules. Check transpilation settings if using Babel or similar tools. Ensure named imports are correctly destructured.
Review the TypeScript source for complex types, conditional types, or advanced Mapped Types that might not have direct `core-types` equivalents. Simplify the TypeScript declaration or use the `unsupported` option in `FromTsOptions` to `warn` or `ignore` (default is `error`).