ostrowr / ts-json-validator

Let JSON play nicely with Typescript
MIT License
342 stars 7 forks source link

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

Closed Mayhem50 closed 4 years ago

Mayhem50 commented 4 years ago

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 ?

ostrowr commented 4 years ago

@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.

Mayhem50 commented 4 years ago

Thanks for your answer. I will do this.

ostrowr commented 4 years ago

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.

ostrowr commented 4 years ago

I'll push a release momentarily.