Skip to content

Instantly share code, notes, and snippets.

@n8io
Last active November 10, 2023 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n8io/1e57bba4f677c315794133b8f66830f4 to your computer and use it in GitHub Desktop.
Save n8io/1e57bba4f677c315794133b8f66830f4 to your computer and use it in GitHub Desktop.
Typescript playground code snippets

JS/TS Playground Code

const config: KnownHostConfig = new Proxy(knownHostsConfig, handler);

// Access via a supported country, returns the country's host
console.log(config.opportunity.DE);
// Access via an unsupported country, returns the fallback host
console.log(config.opportunity.XX);
const routes = {
  USER: '/users/:id',
  USER_ORGANIZATIONS: '/users/:userId/organizations/:organizationId',
  USERS: '/users',
} as const;

const foo: RouteParameters<typeof routes.USER> = {
  id: 3,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment