Support optional type in tuples
MangelMaxime opened this issue · comments
Maxime Mangel commented
TypeScript documentation:
export type LatLngTuple = [number, number, number?];
translates into
type LatLngTuple =
float * float * float option
This is not a perfect representation, but the more user friendly from F# point of view (avoid erased types).
Example of usage in TypeScript
export type LatLngTuple = [number, number, number?];
const coord : LatLngTuple = [1, 2, 3];
const coord1 : LatLngTuple = [1, 2];
const coord2 : LatLngTuple = [1, 2, null]; // Invalid
const coord3 : LatLngTuple = [1, 2, undefined];
Example of npm package using this features: