TypeScript Version: 3.0.0-dev.201 version 2.8.3
Search Terms:
Code
async function* geoJSON(mapConfigurations: DirectionsRequest ): AsyncIterableIterator
let status = false;
console.log(status);
let result: AcyncIterable = null;
while (!status) {
result = await this.getRouteList(mapConfigurations);
status = !status;
console.log(result);
yield result; // "result" + status + ": " + result;
}
}
export function calculation(req: Request) {
let ps = JSON.parse(R.prop("0", req.body));
let result: any;
let points = R.pickAll(["origin", "destination", "waypoints"], ps);
console.log("Points: ", points);
(async function () {
try {
const routeList = new Peer.API.RouteList(points.origin, points.destination, points.waypoints);
let result_query = routeList.query;
let jsonX = geoJSON(result_query);
console.log("calculation", await jsonX.next());
// routeList.feedback();
// result = new Peer.API.Tools(xpath, 43, 5);
// const xpath = asyncIterable[Symbol.asyncIterator]();
// await xpath.next().then((str) => result = new Peer.API.Tools(str.value, 43, 5) );
} catch (err) {
console.error(err);
}
})();
// return { distance: result.totalDistance, cost: result.totalPrice, points: result.Polyline };
}
// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
Expected behavior:
Points: { origin: '50.001170,36.244462',
destination: '49.920557,36.276551',
waypoints: '50.013326,36.244069|50.034276,36.214594|50.033834,36.171648' }
TypeError: Symbol.asyncIterator is not defined.
at __asyncGenerator (/home/geo/PROJECTS/SERVER-AEP/stage.1-TS-Driverlist/build/compiled/CIM/Peer.js:4:38)
at geoJSON (/home/geo/PROJECTS/SERVER-AEP/stage.1-TS-Driverlist/build/compiled/CIM/Peer.js:314:16)
at /home/geo/PROJECTS/SERVER-AEP/stage.1-TS-Driverlist/build/compiled/CIM/Peer.js:335:29
at Object.calculation (/home/geo/PROJECTS/SERVER-AEP/stage.1-TS-Driverlist/build/compiled/CIM/Peer.js:345:11)
at BlogController.post (/home/geo/PROJECTS/SERVER-AEP/stage.1-TS-Driverlist/build/compiled/routing/controllers/BlogController.js:28:47)
at ActionMetadata.callMethod (/home/geo/PROJECTS/SERVER-AEP/stage.1-TS-Driverlist/node_modules/routing-controllers/metadata/ActionMetadata.js:108:48)
at /home/geo/PROJECTS/SERVER-AEP/stage.1-TS-Driverlist/node_modules/routing-controllers/RoutingControllers.js:92:140
at
at process._tickCallback (internal/process/next_tick.js:182:7)
undefined
client connected
Actual behavior:
tsconfig.json
{
"version": "2.8.3",
"compilerOptions": {
"outDir": "build/compiled",
"lib": [
"es2017",
"esnext.asynciterable",
"dom",
"es2015.promise",
"esnext"
],
"target": "es2018",
"module": "commonjs",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"removeComments": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitAny": true,
"declaration": true,
"baseUrl": ".",
"typeRoots": [
"node_modules/@types"
]
},
"include": [
"src//"
],
"exclude": [
"build//",
"node_modules",
"tmp"
]
}
Playground Link:
Related Issues:
Please try to come up with a complete example that can be tested on its own -- I see a lot of errors in the code you posted because context is missing.
pls see attached zip.folder in routs.yml U'll find
{ "origin" : "50.001170,36.244462" , "destination" : "49.920557,36.276551" , "waypoints" : "50.013326,36.244069|50.034276,36.214594|50.033834,36.171648" }
to ctp+C in html localhost:8001
yarn start
Kind Regards Eugene
Вторник, 29 мая 2018, 18:18 +03:00 от Andy notifications@github.com:
Please try to come up with a complete example that can be tested on its own -- I see a lot of errors in the code you posted because context is missing.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub , or mute the thread .
In order to post something as a potential compiler bug it needs to be a contained example -- please try to narrow this down to a short single file that can be posted here in its entirety.
@geomen888 It seems like you are trying to run the resulting code in an environment that doesn't support async iterators. It also seems like you are using Node.js, are you running this with Node.js 10.0.0 or newer?
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
@geomen888 : upgrade the node version to latest.
Most helpful comment
@geomen888 It seems like you are trying to run the resulting code in an environment that doesn't support async iterators. It also seems like you are using Node.js, are you running this with Node.js 10.0.0 or newer?