I'm running TypeScript 2.0.3, configured to with "target": "es2015",
. I started with
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import assert = require('assert');
But in Visual Studio, that gets flagged with a tooltip saying Import with 'require' cannot be used when targeting ECMAScript 6 or higher.
I then tried:
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import {assert} from 'assert';
Which generates Error TS2305 Module '"assert"' has no exported member 'assert'.
I've also tried:
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import assert from 'assert';
Which generates Error TS1192 Module '"assert"' has no default export.
assert
. I think thetsconfig.json
changes from that thread mostly are an alternative to the/// reference...
line in my example.import assert = require('assert')
, and ignore the fact that Visual Studio is flagging that as incompatible with ES2015?