feat: add a type challenge
Node.js CI / Lint and Test (push) Successful in 41s

This commit is contained in:
2025-11-22 18:47:22 -08:00
parent 5061d00f8e
commit 4997db4675
4 changed files with 44 additions and 0 deletions
+1
View File
@@ -17,6 +17,7 @@
"devDependencies": { "devDependencies": {
"@nhcarrigan/eslint-config": "5.2.0", "@nhcarrigan/eslint-config": "5.2.0",
"@nhcarrigan/typescript-config": "4.0.0", "@nhcarrigan/typescript-config": "4.0.0",
"@type-challenges/utils": "0.1.1",
"@types/node": "24.10.1", "@types/node": "24.10.1",
"@vitest/coverage-v8": "4.0.10", "@vitest/coverage-v8": "4.0.10",
"eslint": "9.39.1", "eslint": "9.39.1",
+8
View File
@@ -14,6 +14,9 @@ importers:
'@nhcarrigan/typescript-config': '@nhcarrigan/typescript-config':
specifier: 4.0.0 specifier: 4.0.0
version: 4.0.0(typescript@5.9.3) version: 4.0.0(typescript@5.9.3)
'@type-challenges/utils':
specifier: 0.1.1
version: 0.1.1
'@types/node': '@types/node':
specifier: 24.10.1 specifier: 24.10.1
version: 24.10.1 version: 24.10.1
@@ -461,6 +464,9 @@ packages:
peerDependencies: peerDependencies:
eslint: '>=8.40.0' eslint: '>=8.40.0'
'@type-challenges/utils@0.1.1':
resolution: {integrity: sha512-A7ljYfBM+FLw+NDyuYvGBJiCEV9c0lPWEAdzfOAkb3JFqfLl0Iv/WhWMMARHiRKlmmiD1g8gz/507yVvHdQUYA==}
'@types/chai@5.2.3': '@types/chai@5.2.3':
resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}
@@ -2350,6 +2356,8 @@ snapshots:
- supports-color - supports-color
- typescript - typescript
'@type-challenges/utils@0.1.1': {}
'@types/chai@5.2.3': '@types/chai@5.2.3':
dependencies: dependencies:
'@types/deep-eql': 4.0.2 '@types/deep-eql': 4.0.2
@@ -0,0 +1,28 @@
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import type { Equal, Expect, NotAny } from "@type-challenges/utils";
/**
* Original code:.
*
* ```ts
* type HelloWorld = any // expected to be a string
* ```
*/
type HelloWorld = string;
/**
* Test cases.
*/
// @ts-expect-error -- Unused variable.
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- This is necessary for tests.
type Cases = [
Expect<NotAny<HelloWorld>>,
Expect<Equal<HelloWorld, string>>,
];
+7
View File
@@ -0,0 +1,7 @@
# Type Challenges
These are a little different. They aren't algorithms with return values. Instead, you're given some broken TypeScript code and you must fix it so it compiles.
As such, these challenges do not have tests in the same way others do. They are considered "passing" when the build command succeeds.
https://github.com/type-challenges/type-challenges