This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
begin implementing real real good types for request.cf #301
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: caf0a04 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Regarding Can they just be constants grouped in a namespace (i.e. an object)? I assume that since you were using For example instead of: declare const enum ContinentCode {
Africa = "AF",
Antarctica = "AN",
Asia = "AS",
Europe = "EU",
NorthAmerica = "NA",
Oceania = "OC",
SouthAmerica = "SA",
} Perhaps: declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
declare const ContinentCode = {
Africa: "AF",
Antarctica: "AN",
Asia: "AS",
Europe: "EU",
NorthAmerica: "NA",
Oceania: "OC",
SouthAmerica: "SA",
} as const; |
penalosa
suggested changes
Oct 20, 2022
mrbbot
reviewed
Oct 20, 2022
mrbbot
approved these changes
Oct 20, 2022
penalosa
approved these changes
Oct 20, 2022
Merged
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #296
Resolved, we're using unions instead of enums for now
There's an open issue around the use of `const enum`s to describe certain hardcoded values whose meaning may not be obvious to the user. There's issues around [using `const enum`s in `.d.ts` files](https://www.typescriptlang.org/docs/handbook/enums.html#const-enum-pitfalls). Relevant section quoted here:I'm not sure what approach we want to take. I think if we're moving towards using importable types rather than ambient declarations, this becomes a non-issue. If we keep these declarations ambient, we should do something about it.