You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exist for backward compatibility with earlier versions of TypeScript
However for a vast number of npm modules out there that do export = someFunction there is no ES6 syntax that TypeScript approves of i.e import * as someFunction from "someFunction" will complain that it resolves to a non module entity.
Suggestion:
Either of these would be fine:
import/require should not be marked as deprecated as there is no alternative
import * as someFunction from "someFunction" should be allowed.
Workaround : people (and I) have been doing module someFunction{} to quieten the compiler and then import * as works. I am probably wrong but would like an official way forward.
For short term I think the first option is a fairly easy solution.
But I'm very worried about long term compatibility between TS, commonjs and ESModule. Namely, should allow import DefaultExport from "some-module" when it is declared declare module "some-module" { export = ... }
Reading the official spec : https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#1133-import-require-declarations
It says :
However for a vast number of npm modules out there that do
export = someFunction
there is no ES6 syntax that TypeScript approves of i.eimport * as someFunction from "someFunction"
will complain that it resolves to a non module entity.Suggestion:
Either of these would be fine:
import
/require
should not be marked as deprecated as there is no alternativeimport * as someFunction from "someFunction"
should be allowed.Workaround : people (and I) have been doing
module someFunction{}
to quieten the compiler and thenimport * as
works. I am probably wrong but would like an official way forward./cc @blakeembrey 🌹
The text was updated successfully, but these errors were encountered: