Skip to content

Commit 55122fd

Browse files
authored
Implement branded types without unique symbol (#853)
1 parent 3a8e4a7 commit 55122fd

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.changeset/cool-regions-clap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codama/node-types': patch
3+
---
4+
5+
Branded types now use exact values instead of TypeScript's more restictive `unique symbol`. This will allow multiple versions of the library to coexist.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
export type TitleCaseString = string & {
2-
readonly __stringCase: unique symbol;
2+
readonly ['__stringCase:codama']: 'titleCase';
33
};
44

55
export type PascalCaseString = string & {
6-
readonly __stringCase: unique symbol;
6+
readonly ['__stringCase:codama']: 'pascalCase';
77
};
88

99
export type CamelCaseString = string & {
10-
readonly __stringCase: unique symbol;
10+
readonly ['__stringCase:codama']: 'camelCase';
1111
};
1212

1313
export type KebabCaseString = string & {
14-
readonly __stringCase: unique symbol;
14+
readonly ['__stringCase:codama']: 'kebabCase';
1515
};
1616

1717
export type SnakeCaseString = string & {
18-
readonly __stringCase: unique symbol;
18+
readonly ['__stringCase:codama']: 'snakeCase';
1919
};

0 commit comments

Comments
 (0)