Hello, thanks for creating this, I麓m trying to test the library on a project build with yeoman, react, and typescript, but I get the following TS error that blocks me
Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.
import { graph } from "@pnp/graph";
import { GroupType } from '@pnp/graph/groups';
const groupAddResult = await graph.groups.add("GroupName", "Mail_NickName", GroupType.Office365);
const group = await groupAddResult.group();
Is there a workaround for this?
Thanks
Top-level awaits require a specific build configuration and not available by default in most of the pipelines.
For the time being, awaits are better be used in async functions.
const foo = async () => {
const bar = await baz();
// do smt with bar
};
Cool, thanks
Most helpful comment
Top-level
awaits require a specific build configuration and not available by default in most of the pipelines.For the time being,
awaits are better be used inasyncfunctions.