3 ms·
I rarely butt into practices for languages that I don’t use.[1] But having a flag for “are we type-checking” is a, well, huge red flag. [1] Except some light s
by avgcorrection 3y ago
I rarely butt into practices for languages that I don’t use.[1] But having a flag for “are we type-checking” is a, well, huge red flag.
[1] Except some light scripting
- Ensorceled 3y agoYeah, the article explains in depth why we are this stage with Python ...
- avgcorrection 3y agoThere is always a history. Which does not imply a good reason.
- Ensorceled 3y agoIt's a work in progress, the article didn't say the current situation is ideal, nor am I.
- avgcorrection 3y agoYeah you’re not saying anything.
- leoff 3y agodoesn't Typescript have something similar? ``` import type {foo} from ... ```
- rundev 3y agoNot really. `import type` just means that this import is guaranteed to be removed when compiling to JS. TS already fully erases types during compilation, and this is just a way to guarantee that the imports of types are guaranteed to be erased as well. E.g. for `import { SomeType } from "backend-server"`, you don't want to include your entire server code in the frontend just because you imported the response type of some JSON API. `import type` neatly solves this issue, and it even enforces that you can't import anything but types from your backend. I also want to state that TS already removes regular `import`s that only import types. `import type` is mostly used to help bundlers. https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html https://www.typescriptlang.org/docs/handbook/release-notes/t...