dev.to
TypeScript is wasting my time
While converting a medium sized Nuxt application (~15 pages, i18n, auth, REST API) to TypeScript, I compiled a list of pain points (no specific order). This is not the first time that TS made me miserable while trying to use it. Maybe this is a "me" problem and I lack knowledge or skills. But, if this is the case, I bet that a lot of new developers also hit these roadblocks and didn't say anything because of the hype surrounding TS. … Playground The `options` parameter is underlined with an error because the field `notation` is a string when it should be `"compact" | "standard" | "scientific" | "engineering" | undefined`. Well ... it's hardcoded to `"compact"`, which is pretty close to `"compact"` to me. … The worst part is not even that **I** have to tell TS that Nuxt is injecting my plugin everywhere. The worst part is that I have to make sure that every function signature in the plugin match with the interface. Why can't I infer types from the API itself ? Also, `ctrl + click` become useless as it points to the interface and not the implementation (maybe an IDE issue, but still ...). … - const assertion - type aliases - Mapped Types - this parameters - Intersection types - Record<Keys,Type> - Partial<Type> - Type assertions TypeScript is a compile time *static type checker*. Here you are assembling an object dynamically at runtime (in value space). TypeScript *hates* that - so you have to take TypeScript by the hand and explain to it like it's five.
Related Pain Points3件
TypeScript type inference limitations with dynamic runtime values
6TypeScript struggles with objects assembled dynamically at runtime in value space. Developers must manually explain type relationships using complex features like const assertions, mapped types, and type assertions, making it cumbersome to work with dynamically constructed data.
Misleading TypeScript type errors for valid code patterns
4TypeScript reports compilation errors for hardcoded values that clearly match their expected types (e.g., a hardcoded string 'compact' matching the literal type 'compact'), causing false positive errors and frustration.
Lack of Tooling Suggestions for Type Definitions
4TypeScript tooling never suggests how to type something properly, unlike other typed languages such as ReasonML and Flow. Developers must manually hunt down and write correct type definitions, which is time-consuming and error-prone.