Releases: runem/ts-simple-type
Releases · runem/ts-simple-type
v1.0.0
Breaking Changes
toTypeString
has been renamed totypeToString
.simpleTypeToString
is no longer exported.spread
onSimpleTypeFunctionParameter
has been renamed torest
.hasRestElement
onSimpleTypeTuple
has been renamed torest
.SimpleTypeKind
andSimpleTypeModifierKind
have been converted to string literal unions..methods
andproperties
onSimpleTypeClass
have been renamed tomembers
.argTypes
onSimpleTypeFunction
andSimpleTypeMethod
have been renamed toparameters
.CIRCULAR_REF
SimpleType has been removed.SimpleTypeFunctionArgument
has 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.
optional
is now added properly to class members.- Improved type checking of functions/methods.
- Improved type checking of class/interface/object.
- Type parameters now default to
unknown
instead ofany
. - Members with call signatures are now
methods
instead 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
Symbol
type. - Added support for type checking constructors and call signatures on object types.
- Added
validateType
function 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
serializeSimpleType
anddeserializeSimpleType
functions. - All members of
SimpleType
are nowreadonly
. - If two
ts.Type
values are given toisAssignableToType
, the function will prioritize testing usingisTypeAssignableTo
on 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
).