Ondra Žižka Ondra Žižka - 28 days ago 13
TypeScript Question

TypeScript: How to import ES6 Map (NetBeans can't find)

We switched to from System.js to WebPack, and now NetBeans doesn't know where to find certain types, like

Map
and
Promise
. The compiler is ok. It's just about code completion. I assume it's because the TypeScript plugin only knows how to deal with
systemjs.config.js
.

I have tried this:

$ find -name Map*
...
./ui/src/main/webapp/node_modules/rxjs/util/Map.js
./ui/src/main/webapp/node_modules/rxjs/util/Map.d.ts
./ui/src/main/webapp/node_modules/rxjs/src/util/Map.ts


So I tried these:

//import {Map} from 'rxjs/util/Map'
import {Map} from 'rxjs/src/util/Map'


But they are just (respectively)

export declare const Map: any
---
export const Map = root.Map || (() => MapPolyfill)();


and NetBeans complain on any normal use of the type.

I was also looking at
core-js
(after adding it to systemjs.config.js):

import {Map} from 'core-js/modules/es6.map';


But NetBeans says 'can't find module ...'.

What should I import to declare
Map
to an unaware tool?

Answer

The error was, as some suspected, in the NetBeans plugin. NetBeans plugins repository contains an old version.

Downloading the latest version helped.

Comments