fix(types): pluralize words ending in s like status (#13461)
* fix(types): pluralize words ending in s like status * changeset
This commit is contained in:
1 parent
2a29c6f82c
commit
88748ba09d
3 files changed
+15
-1
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/types": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(types): pluralize words ending in s like status
|
||||||
@@ -18,6 +18,14 @@ describe("Pluralize", () => {
|
|||||||
expectTypeOf<Pluralize<"knife">>().toEqualTypeOf<"knives">()
|
expectTypeOf<Pluralize<"knife">>().toEqualTypeOf<"knives">()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("pluralize words ending with s", () => {
|
||||||
|
expectTypeOf<Pluralize<"status">>().toEqualTypeOf<"statuses">()
|
||||||
|
expectTypeOf<Pluralize<"bus">>().toEqualTypeOf<"buses">()
|
||||||
|
expectTypeOf<Pluralize<"alias">>().toEqualTypeOf<"aliases">()
|
||||||
|
expectTypeOf<Pluralize<"bonus">>().toEqualTypeOf<"bonuses">()
|
||||||
|
expectTypeOf<Pluralize<"bias">>().toEqualTypeOf<"biases">()
|
||||||
|
})
|
||||||
|
|
||||||
test("pluralize words ending with ch", () => {
|
test("pluralize words ending with ch", () => {
|
||||||
expectTypeOf<Pluralize<"church">>().toEqualTypeOf<"churches">()
|
expectTypeOf<Pluralize<"church">>().toEqualTypeOf<"churches">()
|
||||||
expectTypeOf<Pluralize<"arch">>().toEqualTypeOf<"arches">()
|
expectTypeOf<Pluralize<"arch">>().toEqualTypeOf<"arches">()
|
||||||
|
|||||||
@@ -355,6 +355,7 @@ type UncountableRules =
|
|||||||
| "deer"
|
| "deer"
|
||||||
| "sheep"
|
| "sheep"
|
||||||
| "info"
|
| "info"
|
||||||
|
| "species"
|
||||||
|
|
||||||
type PluralizationSpecialRules = {
|
type PluralizationSpecialRules = {
|
||||||
person: "people"
|
person: "people"
|
||||||
@@ -380,7 +381,7 @@ export type Pluralize<Singular extends string> =
|
|||||||
: Singular extends `${infer R}is`
|
: Singular extends `${infer R}is`
|
||||||
? `${R}ises`
|
? `${R}ises`
|
||||||
: Singular extends `${string}s`
|
: Singular extends `${string}s`
|
||||||
? `${Singular}`
|
? `${Singular}es`
|
||||||
: Singular extends `${infer R}ay`
|
: Singular extends `${infer R}ay`
|
||||||
? `${R}ays`
|
? `${R}ays`
|
||||||
: Singular extends `${infer R}ey`
|
: Singular extends `${infer R}ey`
|
||||||
|
|||||||
Reference in new issue
Block a user