π Search Terms
import defer
β
Viability Checklist
β Suggestion
We are working towards a PR implementing the https://github.com/tc39/proposal-defer-import-eval/ proposal, to have TypeScript support ready once the proposal reaches Stage 3. For this proposal I think it should behave as follows:
- This features does not affect type checking, as
import defer * as n and import * as n have the same type.
import defer should only be allowed when targeting ESNext modules, as it's not possible to compile it to older ES versions.
- Even though the proposal only supports
import defer * as n, we should still parse import defer { ... } and import defer foo and give proper diagnostics, rather than relying on the existing parsing recovery for invalid syntax (that would parse import defer { x } from "y" as import defer = <ident>; { x }; from; "y"
When talking about this with @DanielRosenwasser, he mentioned tsserver support. What would tsserver support look like for a feature like this one? I was thinking maybe a "Convert to deferred namespace import" refactor similarly to how we have a "Convert named imports to namespace import" refactor, but:
- is this something that the TS team prefers to have in the initial implementation or separately?
- am I missing something else that is obvious when it comes to tsserver support?
π Motivating Example
/
π» Use Cases
Implementation of a TC39 proposal
π Search Terms
import defer
β Viability Checklist
β Suggestion
We are working towards a PR implementing the https://github.com/tc39/proposal-defer-import-eval/ proposal, to have TypeScript support ready once the proposal reaches Stage 3. For this proposal I think it should behave as follows:
import defer * as nandimport * as nhave the same type.import defershould only be allowed when targeting ESNext modules, as it's not possible to compile it to older ES versions.import defer * as n, we should still parseimport defer { ... }andimport defer fooand give proper diagnostics, rather than relying on the existing parsing recovery for invalid syntax (that would parseimport defer { x } from "y"asimport defer = <ident>; { x }; from; "y"When talking about this with @DanielRosenwasser, he mentioned tsserver support. What would tsserver support look like for a feature like this one? I was thinking maybe a "Convert to deferred namespace import" refactor similarly to how we have a "Convert named imports to namespace import" refactor, but:
π Motivating Example
/
π» Use Cases
Implementation of a TC39 proposal