0
私はブラウザを介して非同期イテレータのtypescript(バージョン2.6を使用して)を使用してビルドされたサンプルを実行しようとしています。 名前が見つかりません__values
`
function* countAppleSales() {
var saleList = [3, 7, 5];
for (var i = 0; i < saleList.length; i++) {
yield saleList[i];
}
}
for(let val of countAppleSales())
console.log(val);
async function* asyncRandomNumbers() {
// This is a web service that returns a random number
const url = 'https://www.random.org/decimal-fractions/?num=1&dec=10&col=1&format=plain&rnd=new';
while (true) {
const response = await fetch(url);
const text = await response.text();
yield Number(text);
}
}
async function example() {
for await (const number of asyncRandomNumbers()) {
console.log(number);
if (number > 0.95) break;
}
}
example();
console.log('we are after await')
;`
コードの上には、ブラウザで罰金を実行しているが、にconsole.logログイン名__valuesを見つけることができないエラーを取得しています。以下
使用していますタイプスクリプトの設定ファイルである:
{
"compilerOptions": {
"module": "es2015",
"types": [
"node"
],
// typeRoots option has been previously configured
"typeRoots": [
// add path to @types
"node_modules/@types"
],
"target": "es6",
"noImplicitAny": false,
"downlevelIteration": false,
"sourceMap": true,
"moduleResolution": "node",
"watch": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
//"noEmitHelpers": true,
"skipDefaultLibCheck": true,
"strictNullChecks": false,
"outDir": "tmp",
//"lib":["es2017","es2015","es2016","es2015.generator","esnext","dom","esnext.asynciterable"]
"lib": [ "es2017","dom","es2015.generator","es2015","es2015.iterable","esnext.asynciterable","esnext"]
},
"allowSyntheticDefaultImports":true,
"baseUrl": ".",
"paths": {
"lodash/*": [
"node_modules/@types/lodash-es/*"
]},
"awesomeTypescriptLoaderOptions": {
"useBabel": true,
"useCache": true
},
"include": [
"src",
"test"
],
"exclude": [
"node_modules",
"typings"
]
}
を誰もがこの問題に
「__values」はどこから来ますか?私はあなたのコードでそれが表示されません。さらに、async function asyncRandomNumbers(非同期ジェネレータ) – Tali
この問題は今解決されました。問題は、webpack設定ファイルでtypescript loader rules configurationを2回貼り付けることによるものです。 webpackのエラーはより具体的である必要があります。 –