-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type-only default+named imports #16
Comments
What am I missing? According to this, TS does support the Hegel/Flow syntax. |
I think it's the difference between import type { APIResponseType } from "./api"; (import an exported type named APIResponseType) and import type APIResponseType from "./api"; (import a default export type, and call it APIResponseType) |
Apologies I misled you first time around. Type-only default imports are supported in TypeScript. The only case that is not handled is requesting both the default and named bindings. |
Got it! And, yes, I say widen the support. |
I went back to the recent history on this. The reason the combined syntax was not added to TypeScript is because of a potential confusion. import a, { type b } from 'mod' // ONLY b is a type import - easily understood vs import type a, { b } from 'mod' // BOTH a & b are type imports - is this obvious to all? For the latter case, users might mistakenly think that I don't think this is essential to resolve right now. So I'd like to leave this as an open issue for now until we hear more from users. |
The champion group discussed this and concluded we will bring this into scope, meaning both default and named imports will be permitted in the same import declaration. Note that this does not imply that TypeScript will permit the form. That's an independent decision. |
The syntax is a bit odd. Background here: tc39/proposal-type-annotations#16
* Change how meta key is detected for coop. gestures UIEvents like 'wheel' include properties for whether some keys are currently pressed, including ctrl and meta. [0] This should be less prone to error, specifically when the user presses or depresses one of these keys while the browser document is not active. Adds a debug page for cooperative gestures because this feature cannot be tested with a fullscreen map, and the only other test page is a fullscreen map. [0] https://w3c.github.io/uievents/#dom-mouseevent-ctrlkey * Add method to enable/disable cooperativeGestures Fixes #2057 Also disable cooperative gestures in fullscreen, using these new methods (Fixes #1488) * Changelog * Combine imports from map The syntax is a bit odd. Background here: tc39/proposal-type-annotations#16 * Remove debug page * Specify event type * Add Map._getMetaKey() * Add cooperative gestures class * Add return value to _getMetaKey() * Add _metaKey property, initialize in constructor * Update expectedBytes to size of bundle on main
Hegel and Flow support type-only imports of the default binding with named bindings like this:
The above is not supported by TypeScript:
A type-only import can specify a default import or named bindings, but not both.
The workaround for TypeScript is to use an alias.
Should we widen the type-only import syntax to account for handling both immediate default imports and named imports?
The text was updated successfully, but these errors were encountered: