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

refactor(experimental): add ClusterUrl types #2084

Merged

Conversation

buffalojoec
Copy link
Contributor

@buffalojoec buffalojoec commented Feb 1, 2024

As per @lorisleiva's suggestion, here's some types for cluster URLs!
Straight from this comment

@buffalojoec buffalojoec force-pushed the 01-31-refactor_experimental_add_ClusterUrl_types branch from f883a80 to c9bb45e Compare February 2, 2024 15:58
Copy link
Contributor Author

buffalojoec commented Feb 2, 2024

Merge activity

@buffalojoec buffalojoec merged commit 61f7ba0 into master Feb 2, 2024
10 checks passed
@buffalojoec buffalojoec deleted the 01-31-refactor_experimental_add_ClusterUrl_types branch February 2, 2024 16:36
export type TestnetUrl = string & { '~cluster': 'testnet' };
export type ClusterUrl = string | MainnetUrl | DevnetUrl | TestnetUrl;

export function mainnet(putativeString: string): MainnetUrl {
Copy link
Collaborator

@steveluscher steveluscher Feb 2, 2024

Choose a reason for hiding this comment

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

Just a nit regarding my favorite word to use in code. This is usually the word I use for assertion functions (ie. ones whose return type is foo is Bar). Putative means ‘supposed’ or ‘assumed to exist.’

This puppy doesn't make any assertions; it's just a typecast utility. mainnet(url: string): MainnetUrl would do fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is your favorite word in code? What about foo? Personally, mine is console.log("FLARE"), but that never gets committed :).

Copy link
Contributor

github-actions bot commented Feb 7, 2024

🎉 This PR is included in version 1.90.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link
Contributor

Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants