Using apollo-codegen 0.18.8 and typescript 2.7.2, I get the following error from Typescript:
[ts] Statements are not allowed in ambient contexts.
The error is caused by the semicolon inserted after the interfaces in the schema.d.ts file, for example:
export interface InterfaceName {
...
};
Is there any CLI option to avoid the generation of semicolons?
+1 manually deleting semicolon kills me.
Same here, with Typescript 2.6.2.
@lewisf Could we just remove the generator.print(';'); from here ? That should fix this issue, but I don't know the exact impact on previous typescript version.
@TiuSh I don't use Typescript on my day to day graphql repo. Can someone confirm that this is okay?
@lewisf After a little digging, it seams that Typescript interfaces should not be followed by semicolon (see https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md for more examples). I created a PR with the given fix and updated tests.
A funny workaround, I run prettier on the generated file to remove the semicolon ...
With the new TypeScript target in the Apollo CLI, semicolons are no longer added after interfaces!
Most helpful comment
+1 manually deleting semicolon kills me.