-
-
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
d923036
commit 7f3b48b
Showing
5 changed files
with
84 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
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,33 @@ | ||
/** | ||
* @file Type Tests - This | ||
* @module esast/nodes/tests/unit-d/This | ||
*/ | ||
|
||
import type { Data, Node } from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
import type * as TestSubject from '../this' | ||
|
||
describe('unit-d:nodes/This', () => { | ||
type Subject = TestSubject.default | ||
type SubjectData = TestSubject.ThisData | ||
|
||
it('should extend Node', () => { | ||
expectTypeOf<Subject>().toMatchTypeOf<Node>() | ||
}) | ||
|
||
it('should match [data?: Optional<ThisData>]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('data') | ||
.toEqualTypeOf<Optional<SubjectData>>() | ||
}) | ||
|
||
it('should match [type: "this"]', () => { | ||
expectTypeOf<Subject>().toHaveProperty('type').toEqualTypeOf<'this'>() | ||
}) | ||
|
||
describe('ThisData', () => { | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* @file Nodes - This | ||
* @module esast/nodes/This | ||
*/ | ||
|
||
import type { Data, Node } from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
|
||
/** | ||
* Info associated with `this` keywords. | ||
* | ||
* @see {@linkcode Data} | ||
* | ||
* @extends {Data} | ||
*/ | ||
interface ThisData extends Data {} | ||
|
||
/** | ||
* The `this` keyword. | ||
* | ||
* @see {@linkcode Node} | ||
* | ||
* @extends {Node} | ||
*/ | ||
interface This extends Node { | ||
/** | ||
* Info from the ecosystem. | ||
* | ||
* @see {@linkcode ThisData} | ||
*/ | ||
data?: Optional<ThisData> | ||
|
||
/** | ||
* Node type. | ||
*/ | ||
type: 'this' | ||
} | ||
|
||
export type { ThisData, This as default } |