mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
These changes do two things. 1. Replace very lax typings like `any[]` with stricter, more-correct versions. In particular, the ISO_8601 constant, while /technically/ a void function, is actually an opaque sentinel that a consumer should not know anything about it. The function type was replaced with a sentinel type using the principle of "brands" that can be seen in the Typescript compiler: https://github.com/Microsoft/TypeScript/blob/413d9a639f933df7539070b236c1677de8302a93/src/compiler/types.ts#L9 2. Replace the many overloads of the parsing methods with a smaller representative set that uses union types instead. Aside from succinctness, this allows callers to provide a union type as the argument, as long as it matches, which was not possible before (Typescript does not explode the union type to see if overloads cover all the possibilities).