-
-
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):
Statement
, StatementMap
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
- Loading branch information
1 parent
8072fbd
commit 39f0a77
Showing
3 changed files
with
57 additions
and
0 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,24 @@ | ||
/** | ||
* @file Type Tests - statement | ||
* @module esast/content/tests/unit-d/statement | ||
*/ | ||
|
||
import type { EmptyStatement } from '@flex-development/esast' | ||
import type * as TestSubject from '../statement' | ||
|
||
describe('unit-d:content/statement', () => { | ||
describe('Statement', () => { | ||
it('should equal StatementMap[keyof StatementMap]', () => { | ||
expectTypeOf<TestSubject.Statement>() | ||
.toEqualTypeOf<TestSubject.StatementMap[keyof TestSubject.StatementMap]> | ||
}) | ||
}) | ||
|
||
describe('StatementMap', () => { | ||
it('should match [emptyStatement: EmptyStatement]', () => { | ||
expectTypeOf<TestSubject.StatementMap>() | ||
.toHaveProperty('emptyStatement') | ||
.toEqualTypeOf<EmptyStatement> | ||
}) | ||
}) | ||
}) |
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
|
||
export type * from './literal' | ||
export type * from './primitive' | ||
export type * from './statement' |
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 - statement | ||
* @module esast/content/statement | ||
*/ | ||
|
||
import type { EmptyStatement } from '@flex-development/esast' | ||
|
||
/** | ||
* Union of registered esast nodes that can occur where a statement is expected. | ||
* | ||
* To register custom esast nodes, augment {@linkcode StatementMap}. They will | ||
* be added to this union automatically. | ||
*/ | ||
type Statement = StatementMap[keyof StatementMap] | ||
|
||
/** | ||
* Registry of nodes that can occur where a {@linkcode Statement} is expected. | ||
* | ||
* This interface can be augmented to register custom node types. | ||
* | ||
* @example | ||
* declare module '@flex-development/docast' { | ||
* interface StatementMap { | ||
* customStatement: CustomStatement | ||
* } | ||
* } | ||
*/ | ||
interface StatementMap { | ||
emptyStatement: EmptyStatement | ||
} | ||
|
||
export type { Statement, StatementMap } |