私は"target": "es2015",
で設定されたTypeScript 2.0.3を実行しています。私はNode.jsからアサートをインポートするためのTypeScript 2.0/ES2015の方法は何ですか?
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import assert = require('assert');
で始めたが、私はその後、試したImport with 'require' cannot be used when targeting ECMAScript 6 or higher.
を言っツールチップでフラグが付けられますのVisual Studioで:
Error TS2305 Module '"assert"' has no exported member 'assert'.
を生成
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import {assert} from 'assert';
私も試してみた:
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import assert from 'assert';
Error TS1192 Module '"assert"' has no default export.
あなたはすでにこれを見たことがありますか?お探しのものに似ているようです:https://github.com/Microsoft/TypeScript/issues/9725 – Igor
ありがとうございます。私は私の世界から角を塞いでいた(私は老犬です)。私はそのスレッドからtsconfig.jsonのトリックを試みます。 –
それは私が 'assert'のために受け取ったエラーメッセージを変更するものではありません。このスレッドの 'tsconfig.json'の変更は、私の例では' /// reference ... '行の代わりに使用されていると思います。 –