-
-
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(nodes):
ExportDefaultDeclaration
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
- Loading branch information
1 parent
a7bd70e
commit 09336a1
Showing
3 changed files
with
108 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,47 @@ | ||
/** | ||
* @file Type Tests - ExportDefaultDeclaration | ||
* @module esast/nodes/tests/unit-d/ExportDefaultDeclaration | ||
*/ | ||
|
||
import type { | ||
ClassDeclaration, | ||
Data, | ||
Expression, | ||
FunctionDeclaration, | ||
Parent | ||
} from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
import type * as TestSubject from '../declaration-export-default' | ||
|
||
describe('unit-d:nodes/ExportDefaultDeclaration', () => { | ||
type Subject = TestSubject.default | ||
type SubjectData = TestSubject.ExportDefaultDeclarationData | ||
|
||
it('should extend Parent', () => { | ||
expectTypeOf<Subject>().toMatchTypeOf<Parent>() | ||
}) | ||
|
||
it('should match [children: [ClassDeclaration | Expression | FunctionDeclaration]]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('children') | ||
.toEqualTypeOf<[ClassDeclaration | Expression | FunctionDeclaration]>() | ||
}) | ||
|
||
it('should match [data?: Optional<ExportDefaultDeclarationData>]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('data') | ||
.toEqualTypeOf<Optional<SubjectData>>() | ||
}) | ||
|
||
it('should match [type: "exportDefaultDeclaration"]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('type') | ||
.toEqualTypeOf<'exportDefaultDeclaration'>() | ||
}) | ||
|
||
describe('ExportDefaultDeclarationData', () => { | ||
it('should extend Data', () => { | ||
expectTypeOf<SubjectData>().toMatchTypeOf<Data>() | ||
}) | ||
}) | ||
}) |
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,57 @@ | ||
/** | ||
* @file Nodes - ExportDefaultDeclaration | ||
* @module esast/nodes/ExportDefaultDeclaration | ||
*/ | ||
|
||
import type { | ||
ClassDeclaration, | ||
Data, | ||
Expression, | ||
FunctionDeclaration, | ||
Parent | ||
} from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
|
||
/** | ||
* Info associated with default `export` declarations. | ||
* | ||
* @see {@linkcode Data} | ||
* | ||
* @extends {Data} | ||
*/ | ||
interface ExportDefaultDeclarationData extends Data {} | ||
|
||
/** | ||
* A default `export` declaration. | ||
* | ||
* @see {@linkcode Parent} | ||
* | ||
* @extends {Parent} | ||
*/ | ||
interface ExportDefaultDeclaration extends Parent { | ||
/** | ||
* List of children. | ||
* | ||
* @see {@linkcode ClassDeclaration} | ||
* @see {@linkcode Expression} | ||
* @see {@linkcode FunctionDeclaration} | ||
*/ | ||
children: [declaration: ClassDeclaration | Expression | FunctionDeclaration] | ||
|
||
/** | ||
* Info from the ecosystem. | ||
* | ||
* @see {@linkcode ExportDefaultDeclarationData} | ||
*/ | ||
data?: Optional<ExportDefaultDeclarationData> | ||
|
||
/** | ||
* Node type. | ||
*/ | ||
type: 'exportDefaultDeclaration' | ||
} | ||
|
||
export type { | ||
ExportDefaultDeclarationData, | ||
ExportDefaultDeclaration as default | ||
} |
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