-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(content):
ModuleDeclaration
, ModuleDeclarationMap
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
- Loading branch information
1 parent
a72c6aa
commit 8f0c0be
Showing
5 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @file Type Tests - moduleDeclaration | ||
* @module esast/content/tests/unit-d/moduleDeclaration | ||
*/ | ||
|
||
import type { ExportDeclarationMap } from '@flex-development/esast' | ||
import type * as TestSubject from '../declaration-module' | ||
|
||
describe('unit-d:content/moduleDeclaration', () => { | ||
describe('ModuleDeclaration', () => { | ||
it('should equal ModuleDeclarationMap[keyof ModuleDeclarationMap]', () => { | ||
// Arrange | ||
type K = keyof TestSubject.ModuleDeclarationMap | ||
type Expect = TestSubject.ModuleDeclarationMap[K] | ||
|
||
// Expect | ||
expectTypeOf<TestSubject.ModuleDeclaration>().toEqualTypeOf<Expect> | ||
}) | ||
}) | ||
|
||
describe('ModuleDeclarationMap', () => { | ||
it('should extend ExportDeclarationMap', () => { | ||
expectTypeOf<TestSubject.ModuleDeclarationMap>() | ||
.toMatchTypeOf<ExportDeclarationMap>() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* @file Content - moduleDeclaration | ||
* @module esast/content/moduleDeclaration | ||
*/ | ||
|
||
import type { ExportDeclarationMap } from '@flex-development/esast' | ||
|
||
/** | ||
* Union of registered esast nodes that can occur where a module declaration is | ||
* expected. | ||
* | ||
* To register custom esast nodes, augment {@linkcode ModuleDeclarationMap}. | ||
* They will be added to this union automatically. | ||
*/ | ||
type ModuleDeclaration = ModuleDeclarationMap[keyof ModuleDeclarationMap] | ||
|
||
/** | ||
* Registry of nodes that can occur where a {@linkcode ModuleDeclaration} is | ||
* expected. | ||
* | ||
* This interface can be augmented to register custom node types. | ||
* | ||
* @example | ||
* declare module '@flex-development/esast' { | ||
* interface ModuleDeclarationMap { | ||
* customModuleDeclaration: CustomModuleDeclaration | ||
* } | ||
* } | ||
*/ | ||
interface ModuleDeclarationMap extends ExportDeclarationMap {} | ||
|
||
export type { ModuleDeclaration, ModuleDeclarationMap } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters