Reputation: 291
Though whenStable
returns a promise, I'm not allowed to use await.
Below are my tsconfig
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
I'm using "typescript": "^2.1.5"
Upvotes: 4
Views: 3127
Reputation: 2945
As stated in the error message: 'await' is only allowed within async function. When you want to use await
, you have to mark the outer function with async
keyword.
// example
const myAsyncFunction = async () => {
// ... some code
await fixture.whenStable();
// ... some code
}
When you mark any function with async
keyword it returns a promise. Take a look at this question for better explanation of async/await.
Upvotes: 4