Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iov-types] Symbol private public keys #13

Merged
merged 2 commits into from
May 6, 2018

Conversation

ethanfrey
Copy link
Contributor

Based on microsoft/TypeScript#202 (comment), use:

declare const InputConnectorIdentity: unique symbol

idiom instead of

declare const enum InputConnectorIdentity = {}

I don't understand the difference between them both, but the first seems to be the more recently agreed upon in the ts discussion...

microsoft/TypeScript#4895 (comment)

@ethanfrey ethanfrey requested a review from will-iov May 2, 2018 15:19
@ethanfrey ethanfrey changed the base branch from master to enum-private-public-keys May 2, 2018 15:19
@ethanfrey ethanfrey changed the title Symbol private public keys [iov-types] Symbol private public keys May 2, 2018
@will-iov will-iov changed the base branch from enum-private-public-keys to master May 2, 2018 18:25
Copy link
Contributor

@will-iov will-iov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how I feel about this. Definitely enum is not a very helpful way of describing what's being done here, but the unique symbol approach seems to muddy the waters between types and instances somehow. I liked the cleanliness of

type AddressString = Address & string;

vs

type AddressString = typeof Address & string;

It would be more verbose, but what about this?

declare const AddressSymbol: unique symbol;
type Address = typeof AddressSymbol;
export type AddressString = Address & string;

@ethanfrey
Copy link
Contributor Author

I had the same thought you did. But then figured I would just follow others design.

Please do update this with the symbol and type distinction

@will-iov will-iov merged commit 181f3ed into master May 6, 2018
@will-iov will-iov deleted the symbol-private-public-keys branch May 6, 2018 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants