From 1c10334d06faf8ed7204127db9c063680492c9e1 Mon Sep 17 00:00:00 2001 From: Lexus Drumgold Date: Sun, 5 Feb 2023 13:29:32 -0500 Subject: [PATCH] feat(ts-next): support `--moduleResolution node` - microsoft/TypeScript#51901 Signed-off-by: Lexus Drumgold --- src/enums/__tests__/module-resolution-kind.spec-d.ts | 6 ++++++ src/enums/module-resolution-kind.ts | 3 ++- src/types/__tests__/module-resolution.spec-d.ts | 8 ++++++++ src/types/module-resolution.ts | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/enums/__tests__/module-resolution-kind.spec-d.ts b/src/enums/__tests__/module-resolution-kind.spec-d.ts index 8c3258c6..ba8ab47a 100644 --- a/src/enums/__tests__/module-resolution-kind.spec-d.ts +++ b/src/enums/__tests__/module-resolution-kind.spec-d.ts @@ -31,6 +31,12 @@ describe('unit:enums/ModuleResolutionKind', () => { .toMatchTypeOf<'node'>() }) + it('should match [Node10 = "node10"]', () => { + expectTypeOf() + .toHaveProperty('Node10') + .toMatchTypeOf<'node10'>() + }) + it('should match [Node16 = "node16"]', () => { expectTypeOf() .toHaveProperty('Node16') diff --git a/src/enums/module-resolution-kind.ts b/src/enums/module-resolution-kind.ts index bade33be..00015757 100644 --- a/src/enums/module-resolution-kind.ts +++ b/src/enums/module-resolution-kind.ts @@ -15,8 +15,9 @@ import type { ModuleResolution } from '#src/types' enum ModuleResolutionKind { Bundler = 'bundler', Classic = 'classic', - NodeJs = 'node', + Node10 = 'node10', Node16 = 'node16', + NodeJs = 'node', NodeNext = 'nodenext' } diff --git a/src/types/__tests__/module-resolution.spec-d.ts b/src/types/__tests__/module-resolution.spec-d.ts index 70d3f8b7..ecf99af3 100644 --- a/src/types/__tests__/module-resolution.spec-d.ts +++ b/src/types/__tests__/module-resolution.spec-d.ts @@ -23,6 +23,10 @@ describe('unit:types/ModuleResolution', () => { expectTypeOf().extract<'Node'>().toBeString() }) + it('should extract "Node10"', () => { + expectTypeOf().extract<'Node10'>().toBeString() + }) + it('should extract "Node16"', () => { expectTypeOf().extract<'Node16'>().toBeString() }) @@ -44,6 +48,10 @@ describe('unit:types/ModuleResolution', () => { expectTypeOf().extract<'node'>().toBeString() }) + it('should extract "node10"', () => { + expectTypeOf().extract<'node10'>().toBeString() + }) + it('should extract "node16"', () => { expectTypeOf().extract<'node16'>().toBeString() }) diff --git a/src/types/module-resolution.ts b/src/types/module-resolution.ts index 0839b17b..84f04b87 100644 --- a/src/types/module-resolution.ts +++ b/src/types/module-resolution.ts @@ -11,7 +11,7 @@ import type { OrLowercase } from '@flex-development/tutils' * @see https://www.typescriptlang.org/tsconfig#moduleResolution */ type ModuleResolution = OrLowercase< - 'Bundler' | 'Classic' | 'Node' | 'Node16' | 'NodeNext' + 'Bundler' | 'Classic' | 'Node' | 'Node10' | 'Node16' | 'NodeNext' > export type { ModuleResolution as default }