From 8ca571fdfa6bf42441fbf204e583df40ac9765c0 Mon Sep 17 00:00:00 2001 From: Alexandroppolus <1175181+alexandroppolus@users.noreply.github.com> Date: Sat, 20 Sep 2025 16:10:44 +0000 Subject: [PATCH] feat(question): add #37398 - All Except Never --- .../37398-hard-all-except-never/README.md | 1 + .../37398-hard-all-except-never/info.yml | 6 +++++ .../37398-hard-all-except-never/template.ts | 3 +++ .../37398-hard-all-except-never/test-cases.ts | 26 +++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 questions/37398-hard-all-except-never/README.md create mode 100644 questions/37398-hard-all-except-never/info.yml create mode 100644 questions/37398-hard-all-except-never/template.ts create mode 100644 questions/37398-hard-all-except-never/test-cases.ts diff --git a/questions/37398-hard-all-except-never/README.md b/questions/37398-hard-all-except-never/README.md new file mode 100644 index 00000000..0ede7cbe --- /dev/null +++ b/questions/37398-hard-all-except-never/README.md @@ -0,0 +1 @@ +Write function `myFunc` so that it can accept any argument type except type `never`. diff --git a/questions/37398-hard-all-except-never/info.yml b/questions/37398-hard-all-except-never/info.yml new file mode 100644 index 00000000..8f9c7fb8 --- /dev/null +++ b/questions/37398-hard-all-except-never/info.yml @@ -0,0 +1,6 @@ +difficulty: hard +title: All Except Never +author: + github: alexandroppolus + name: Alexandroppolus + diff --git a/questions/37398-hard-all-except-never/template.ts b/questions/37398-hard-all-except-never/template.ts new file mode 100644 index 00000000..a3b3f9a6 --- /dev/null +++ b/questions/37398-hard-all-except-never/template.ts @@ -0,0 +1,3 @@ +function myFunc(x: any) { + console.log(x); +} diff --git a/questions/37398-hard-all-except-never/test-cases.ts b/questions/37398-hard-all-except-never/test-cases.ts new file mode 100644 index 00000000..5175b945 --- /dev/null +++ b/questions/37398-hard-all-except-never/test-cases.ts @@ -0,0 +1,26 @@ +declare const x0: never; +declare const x1: void; +declare const x2: unknown; +declare const x3: never[]; +declare const x4: 1 | 2 | 3n; +declare const x5: string; +declare const x6: boolean | number; +declare const x7: undefined | {a: 123} | VoidFunction; +declare const x8: string[]; +declare const x9: {} | []; +declare const x10: any; + + +// @ts-expect-error +myFunc(x0); + +myFunc(x1); +myFunc(x2); +myFunc(x3); +myFunc(x4); +myFunc(x5); +myFunc(x6); +myFunc(x7); +myFunc(x8); +myFunc(x9); +myFunc(x10);