-
-
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.
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
- Loading branch information
1 parent
7e234fe
commit 4e6af0f
Showing
7 changed files
with
102 additions
and
14 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
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
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,41 @@ | ||
/** | ||
* @file Type Tests - StaticBlock | ||
* @module esast/nodes/tests/unit-d/StaticBlock | ||
*/ | ||
|
||
import type { Comment, Data, Parent, Statement } from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
import type * as TestSubject from '../static-block' | ||
|
||
describe('unit-d:nodes/StaticBlock', () => { | ||
type Subject = TestSubject.default | ||
type SubjectData = TestSubject.StaticBlockData | ||
|
||
it('should extend Parent', () => { | ||
expectTypeOf<Subject>().toMatchTypeOf<Parent>() | ||
}) | ||
|
||
it('should match [children: (Comment | Statement)[]]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('children') | ||
.toEqualTypeOf<(Comment | Statement)[]>() | ||
}) | ||
|
||
it('should match [data?: Optional<StaticBlockData>]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('data') | ||
.toEqualTypeOf<Optional<SubjectData>>() | ||
}) | ||
|
||
it('should match [type: "staticBlock"]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('type') | ||
.toEqualTypeOf<'staticBlock'>() | ||
}) | ||
|
||
describe('StaticBlockData', () => { | ||
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
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,49 @@ | ||
/** | ||
* @file Nodes - StaticBlock | ||
* @module esast/nodes/StaticBlock | ||
*/ | ||
|
||
import type { Comment, Data, Parent, Statement } from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
|
||
/** | ||
* Info associated with static initialization blocks. | ||
* | ||
* @see {@linkcode Data} | ||
* | ||
* @extends {Data} | ||
*/ | ||
interface StaticBlockData extends Data {} | ||
|
||
/** | ||
* A [static initialization block][1]. | ||
* | ||
* [1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Classes/Static_initialization_blocks | ||
* | ||
* @see {@linkcode Parent} | ||
* | ||
* @extends {Parent} | ||
*/ | ||
interface StaticBlock extends Parent { | ||
/** | ||
* List of children. | ||
* | ||
* @see {@linkcode Comment} | ||
* @see {@linkcode Statement} | ||
*/ | ||
children: (Comment | Statement)[] | ||
|
||
/** | ||
* Info from the ecosystem. | ||
* | ||
* @see {@linkcode StaticBlockData} | ||
*/ | ||
data?: Optional<StaticBlockData> | ||
|
||
/** | ||
* Node type. | ||
*/ | ||
type: 'staticBlock' | ||
} | ||
|
||
export type { StaticBlockData, StaticBlock as default } |