yatts-typescript v1.1.1
yatts-typescript
Keep your typescript version synchronized with a patched version that exposes internal definitions and some private methods for type checking.
How does it work?
When you run pnpm yatts-typescript-sync, it will look for your installed version of typescript, make a copy in its own location, apply the patches and re-export the patched version. So you can import yatts-typescript and enjoy your patched version of typescript while keeping your original version intact.
What does it add/remove?
Removes all
@internaltags which allows you to access internal types, classes, properties and methods with their declarations.Export some very useful private methods from the
TypeChecker:function isTypeSubtypeOf(source: Type, target: Type): boolean; function isTypeIdenticalTo(source: Type, target: Type): boolean; function isTypeDerivedFrom(source: Type, target: Type): boolean; function isTypeAssignableTo(source: Type, target: Type): boolean; function isTypeComparableTo(source: Type, target: Type): boolean; function areTypesComparable(source: Type, target: Type): boolean;
Installation
pnpm add typescript yatts-typescriptKeep yatts-typescript in sync with each installation/update of typescript
Add an postinstall or prepare field in your package.json with pnpm yatts-typescript-sync in it.
{
"postinstall": "pnpm yatts-typescript-sync"
}Usage
import ts from 'yatts-typescript';
// Use ts as usual.Programmatic API
import { patch } from 'yatts-typescript/patch';
const { error, success, modulePath } = patch(options);Options
- typescriptModuleId:
string | undefined- Default totypescript. - outputDirectory:
string | undefined- Default tonode_modules/yatts-typescript/lib. - patchRules:
[PatchRule, ...PatchRule[]] | undefined- Default toundefined. - additionalPatchRules:
PatchRule[] | undefined- Default toundefined.
Alternatives
yatts-typescript is a combination of the alternatives listed below. But instead of maintaining an up-to-date build of typescript we use your locally installed version.
Remove @internal tags
- byots Bring your own TypeScript with more internal definitions
- ts-expose-internals Expose TypeScript internal types by simply adding a development dependency
Expose TypeChecker methods
- tsd-typescript TypeScript with some extras for type-checking.
Remove @internal tags and expose TypeChecker methods
- unleashed-typescript TypeScript with exposed internal definitions and some private methods for type checking.
Scaffolded with @skarab/skaffold