Skip to content

Commit

Permalink
feat(ts-next): support --moduleResolution node
Browse files Browse the repository at this point in the history
- microsoft/TypeScript#51901

Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Feb 5, 2023
1 parent 632b71c commit 1c10334
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/enums/__tests__/module-resolution-kind.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ describe('unit:enums/ModuleResolutionKind', () => {
.toMatchTypeOf<'node'>()
})

it('should match [Node10 = "node10"]', () => {
expectTypeOf<typeof TestSubject>()
.toHaveProperty('Node10')
.toMatchTypeOf<'node10'>()
})

it('should match [Node16 = "node16"]', () => {
expectTypeOf<typeof TestSubject>()
.toHaveProperty('Node16')
Expand Down
3 changes: 2 additions & 1 deletion src/enums/module-resolution-kind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down
8 changes: 8 additions & 0 deletions src/types/__tests__/module-resolution.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ describe('unit:types/ModuleResolution', () => {
expectTypeOf<TestSubject>().extract<'Node'>().toBeString()
})

it('should extract "Node10"', () => {
expectTypeOf<TestSubject>().extract<'Node10'>().toBeString()
})

it('should extract "Node16"', () => {
expectTypeOf<TestSubject>().extract<'Node16'>().toBeString()
})
Expand All @@ -44,6 +48,10 @@ describe('unit:types/ModuleResolution', () => {
expectTypeOf<TestSubject>().extract<'node'>().toBeString()
})

it('should extract "node10"', () => {
expectTypeOf<TestSubject>().extract<'node10'>().toBeString()
})

it('should extract "node16"', () => {
expectTypeOf<TestSubject>().extract<'node16'>().toBeString()
})
Expand Down
2 changes: 1 addition & 1 deletion src/types/module-resolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

0 comments on commit 1c10334

Please sign in to comment.