feat(question): add #37398 - All Except Never

This commit is contained in:
Alexandroppolus 2025-09-20 16:10:44 +00:00
parent b36c05c9cd
commit 8ca571fdfa
4 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1 @@
Write function `myFunc` so that it can accept any argument type except type `never`.

View File

@ -0,0 +1,6 @@
difficulty: hard
title: All Except Never
author:
github: alexandroppolus
name: Alexandroppolus

View File

@ -0,0 +1,3 @@
function myFunc(x: any) {
console.log(x);
}

View 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);