fix: Add a type-checking fast path for primitive types (#755)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
When `Draft<T>` is applied to a large enum type, TypeScript has to do a lot of unnecessary structural comparisons to confirm that no element of the enum matches `Function`, `Date`, `RegExp`, etc. Determining that they do match `string` or `number`, on the other hand, is trivial. This change splits `PrimitiveType` out of `AtomicObject` so that the fast path can be checked first. In https://github.com/microsoft/TypeScript/issues/42824, this cut the check time from ~2.5 seconds to ~0.3 seconds.
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+17 added−15 removed
- other:+17 added−15 removed