4 ms·
There are always reasons to use the escape hatch. For example, I recently needed to cast to a known type and access a property, but didn't want to reference tha
by aluminum96 5y ago
There are always reasons to use the escape hatch. For example, I recently needed to cast to a known type and access a property, but didn't want to reference that type directly, so as to retain the ability to tree shake it. This requires asserting that the property exists, and turning off eslint for that line.
- atom_arranger 5y agoYou could use a type only import for the type, gets taken out completely when compiled, so no tree shaking issue. https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export https://www.typescriptlang.org/docs/handbook/release-notes/t...