ostrowr/ts-json-validator

Can't export schema: Exported variable 'schema' has or is using name 'InternalTypeSymbol'

Mayhem50 opened this issue · 4 comments

Very impressive work. But you cannot export your schema. It is really a problem.

Exported variable 'schema' has or is using name 'InternalTypeSymbol' from external module "/home/xxxx/project/node_modules/ts-json-validator/dist/json-schema" but cannot be named.ts(4023)

Have I do something wrong ? Is there any workaround ?

@Mayhem50 this happens if you try to export a schema in a Typescript project that has "declaration": true specified in tsconfig.json.

If you don't need that flag (i.e. you don't need to generate .d.ts files upon build for other libraries that depend on your project) then you can just remove that flag as a workaround.

However, this is definitely a bug and I'm investigating a real fix, so leaving this open.

Thanks for your answer. I will do this.

This is now fixed! I couldn't figure out a way to do it with InternalTypeSymbol as a unique symbol, so we're using a (hopefully unique) string now. See #23.

I'll push a release momentarily.