-
Notifications
You must be signed in to change notification settings - Fork 20
Conversation
Thank you for submitting this PR!
Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. |
We purposefully generate types from jsdoc comments to mitigate the risk of them becoming out of sync, unless the construct you are trying to type is impossible to represent with jsdoc comments, in which case they go in a
This seems to be the actual problem here. What are the conditions under which this stops working? |
I am familiar with the concept using JSDoc to generate Typescript types. The problem here is that Typescript isn't even able to express this: https://github.com/ipfs/interface-datastore/blob/master/src/key.js#L78-L80 So, the correct behavior for Typescript is to fail on this - independent whether it's a |
cc @Gozala - any thoughts on this?
My gut feeling is all this |
It shouldn't really be loading from |
I do not believe this is accurate, following is valid: interface Key {
[Symbol.toStringTag]:"Key"
//...
} |
I like this changes, generally I prefer coding against interfaces as opposed to concrete implementation / or classes. This pull seems to do that, so I'm in favor |
Update
Turned this into a draft as Symbol keys requires Typescript 4.2 which is supposed to be released end ob February.
For more context, see https://stackoverflow.com/questions/59118271/using-symbol-as-object-key-type-in-typescript
Typescript seems to be unable to import under certain conditions types from
.js
files.This PR adds the missing type and makes sure that Typescript does not try to import types from
.js
.Background
Missing Key type breaks type checking with Typescript on libp2p 0.30.