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

Make PromiseIndex a nominal typing, require explicit construction #260

Merged
merged 3 commits into from
Oct 12, 2022

Conversation

ailisp
Copy link
Member

@ailisp ailisp commented Oct 12, 2022

Fix #118 . Makes PromiseIndex a nominal type, which is different from bigint or number. User cannot construct such a type, unless force typecast x as unknown as PromiseIndex. Since typescript cannot really prevent user force typecast to an exported type, I think it's the closest semantics to "There should be no way to manually construct a promise index, (PromiseIndex) are only constructed by those functions" suggested by @austinabell

@ailisp ailisp marked this pull request as ready for review October 12, 2022 07:13
@ailisp ailisp requested a review from volovyks as a code owner October 12, 2022 07:13
@volovyks volovyks merged commit dc6f07b into develop Oct 12, 2022
@ailisp ailisp deleted the promise-index-type branch October 13, 2022 01:40
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.

Make PromiseIndex type to avoid misuse of promise indices
2 participants