mirror of
https://github.com/type-challenges/type-challenges.git
synced 2025-12-08 19:06:13 +00:00
feat(question): add #37398 - All Except Never
This commit is contained in:
parent
b36c05c9cd
commit
8ca571fdfa
1
questions/37398-hard-all-except-never/README.md
Normal file
1
questions/37398-hard-all-except-never/README.md
Normal file
@ -0,0 +1 @@
|
||||
Write function `myFunc` so that it can accept any argument type except type `never`.
|
||||
6
questions/37398-hard-all-except-never/info.yml
Normal file
6
questions/37398-hard-all-except-never/info.yml
Normal file
@ -0,0 +1,6 @@
|
||||
difficulty: hard
|
||||
title: All Except Never
|
||||
author:
|
||||
github: alexandroppolus
|
||||
name: Alexandroppolus
|
||||
|
||||
3
questions/37398-hard-all-except-never/template.ts
Normal file
3
questions/37398-hard-all-except-never/template.ts
Normal file
@ -0,0 +1,3 @@
|
||||
function myFunc(x: any) {
|
||||
console.log(x);
|
||||
}
|
||||
26
questions/37398-hard-all-except-never/test-cases.ts
Normal file
26
questions/37398-hard-all-except-never/test-cases.ts
Normal file
@ -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);
|
||||
Loading…
x
Reference in New Issue
Block a user