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
This is marked "closed," but I am still seeing this issue on TypeScript 3.8.3.
TypeScript Version: 3.8.3
Search Terms: import type
Code
importtype*asmonacofrom"monaco-editor";// Trying to create a subtype of IViewZone that provides// a guarantee that marginDomNode is not null.interfaceMyViewZoneextendsmonaco.editor.IViewZone{marginDomNode: HTMLElement;}
Expected behavior:
This should typecheck.
Actual behavior:
error TS1361: 'monaco' cannot be used as a value because it was imported using 'import type'.
24 interface MyViewZone extends monaco.editor.IViewZone {
~~~~~~
src/zoneManager.ts:5:13
5 import type * as monaco from "monaco-editor";
~~~~~~~~~~~
'monaco' was imported here.
Note that in the same file, I can do:
type ZoneWidget = {
afterLineNumber: number;
zone: monaco.editor.IViewZone;
};
so it is surprising that I can use monaco.editor.IViewZone in one place but not the other.
Playground Link:
Unfortunately, I cannot repro in a playground as I would expect. Perhaps this is something specific to monaco-editor? For example, doing something analogous with the http Node built-in works fine:
TypeScript Version: 3.8.0-dev.20200128
Search Terms:
Code
For the TS:
Expected behavior:
No errors.
iface
is only being used as a type, not a valueActual behavior:
Error:
This code previously did not produce errors in TS 3.8-beta
Related issues
/cc @andrewbranch
The text was updated successfully, but these errors were encountered: