Releases: runem/ts-simple-type
Releases · runem/ts-simple-type
v1.0.0
Breaking Changes
toTypeStringhas been renamed totypeToString.simpleTypeToStringis no longer exported.spreadonSimpleTypeFunctionParameterhas been renamed torest.hasRestElementonSimpleTypeTuplehas been renamed torest.SimpleTypeKindandSimpleTypeModifierKindhave been converted to string literal unions..methodsandpropertiesonSimpleTypeClasshave been renamed tomembers.argTypesonSimpleTypeFunctionandSimpleTypeMethodhave been renamed toparameters.CIRCULAR_REFSimpleType has been removed.SimpleTypeFunctionArgumenthas been renamed toSimpleTypeFunctionParameter.
Bug Fixes
- Added support for "Object", "Number", "Boolean", "BigInt", "String".
- Improved type checking support for intersection types.
- Fixed type checking of function type rest parameters.
optionalis now added properly to class members.- Improved type checking of functions/methods.
- Improved type checking of class/interface/object.
- Type parameters now default to
unknowninstead ofany. - Members with call signatures are now
methodsinstead offunctions.
Features
- All
SimpleType's are now lazy per default. Types will evaluate when interacting with the object. This behavior can be overwritten with{eager: true}. - Added helper functions to serialize and deserialize types making it possible to store types with circular references.
- Added new SimpleTypeKind "NON_PRIMITIVE" representing the non-primitive type:
object. - Added new SimpleTypeKidn "ES_SYMBOL" and "ES_SYMBOL_UNIQUE" representing the
Symboltype. - Added support for type checking constructors and call signatures on object types.
- Added
validateTypefunction that makes it possible easily make custom validator functions withSimpleType. - The results of converting Type to SimpleType are now always cached and used whenever calling
toSimpleType. It's possible to supply this function with your own cache. - The results of checking type assignability are now always cached and used whenever calling
isAssignableToType. It's possible to supply this function with your own cache. - Added
serializeSimpleTypeanddeserializeSimpleTypefunctions. - All members of
SimpleTypeare nowreadonly. - If two
ts.Typevalues are given toisAssignableToType, the function will prioritize testing usingisTypeAssignableToon the type checker if it has been exposed.
Project
- Updated all dependencies.
- Cleaned up project structure.
- Added script to quickly test and debug assignability (
npm run playground).