TypeScript and MST
TypeScript support is best-effort as not all patterns can be expressed in TypeScript. Except for assigning snapshots to properties we get pretty close! As MST uses the latest fancy TypeScript features it is required to use TypeScript 3.0 or later with noImplicitThis
and strictNullChecks
enabled.
-Actually, the more strict options that are enabled, the better the type system will behave.
TypeScript support is best-effort as not all patterns can be expressed in TypeScript. Except for assigning snapshots to properties we get pretty close! As MST uses the latest fancy TypeScript features it is required to use TypeScript 3.0 or later with noImplicitThis
and strictNullChecks
enabled.
The more strict options that are enabled, the better the type system will behave.
Recommend compiler flags
The recommended compiler flags (against which all our tests are written) are:
{
- "strictNullChecks": true,
- "strictFunctionTypes": true,
- "noImplicitAny": true,
- "noImplicitReturns": true,
- "noImplicitThis": true
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "noImplicitAny": true,
+ "noImplicitReturns": true,
+ "noImplicitThis": true
}
Or shorter by leveraging strict
: