We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I need some guidance / docs about how to properly extend from a branded ID
// common.ts import type { Flavor } from 'nom-ts'; export type NodeId = Flavor<string, 'NodeId'>; export interface Node<Id extends NodeId> { id: Id; comment?: string; createdAt: string; } export interface Edge< NodeClassId extends NodeId, NodeClass extends Node<NodeClassId>, > { node: NodeClass; createdAt: string; } // ----------------------------------------------------------------------- // cat.ts import type { Flavor } from 'nom-ts'; import type { Node, NodeId } from './common'; export type CatId = Flavor<NodeId, 'CatId'>; export type PersonId = Flavor<NodeId, 'PersonId'>; const cid: CatId = 'a' as CatId; const lid: PersonId = 'b' as PersonId; const lid2: PersonId = cid; // No error :( export interface Cat extends Node<CatId> { name: string; ownerId: PersonId; } export type CatCreate = Omit<Cat, 'id' | 'createdAt'>;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I need some guidance / docs about how to properly extend from a branded ID
The text was updated successfully, but these errors were encountered: