-
-
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.
refactor(nodes):
SatisfiesAssertion
-> SatisfiesExpression
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
- Loading branch information
1 parent
b88e339
commit cf96431
Showing
8 changed files
with
125 additions
and
31 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,35 @@ | ||
/** | ||
* @file Type Tests - SatisfiesExpression | ||
* @module esast/nodes/tests/unit-d/SatisfiesExpression | ||
*/ | ||
|
||
import type { Data, Parent } from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
import type * as TestSubject from '../expression-satisfies' | ||
|
||
describe('unit-d:nodes/SatisfiesExpression', () => { | ||
type Subject = TestSubject.default | ||
type SubjectData = TestSubject.SatisfiesExpressionData | ||
|
||
it('should extend Parent', () => { | ||
expectTypeOf<Subject>().toMatchTypeOf<Parent>() | ||
}) | ||
|
||
it('should match [data?: Optional<SatisfiesExpressionData>]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('data') | ||
.toEqualTypeOf<Optional<SubjectData>>() | ||
}) | ||
|
||
it('should match [type: "satisfiesExpression"]', () => { | ||
expectTypeOf<Subject>() | ||
.toHaveProperty('type') | ||
.toEqualTypeOf<'satisfiesExpression'>() | ||
}) | ||
|
||
describe('SatisfiesExpressionData', () => { | ||
it('should extend Data', () => { | ||
expectTypeOf<SubjectData>().toMatchTypeOf<Data>() | ||
}) | ||
}) | ||
}) |
18 changes: 9 additions & 9 deletions
18
...s/__tests__/assertion-satisfies.spec-d.ts → ...odes/__tests__/satisfies-clause.spec-d.ts
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
26 changes: 13 additions & 13 deletions
26
src/nodes/assertion-satisfies.ts → src/nodes/expression-satisfies.ts
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 |
---|---|---|
@@ -1,59 +1,59 @@ | ||
/** | ||
* @file Nodes - SatisfiesAssertion | ||
* @module esast/nodes/SatisfiesAssertion | ||
* @file Nodes - SatisfiesExpression | ||
* @module esast/nodes/SatisfiesExpression | ||
*/ | ||
|
||
import type { | ||
Comments, | ||
Data, | ||
Expression, | ||
Parent, | ||
TypeExpression | ||
SatisfiesClause | ||
} from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
|
||
/** | ||
* Info associated with `satisfies` assertions. | ||
* Info associated with `satisfies` expressions. | ||
* | ||
* @see {@linkcode Data} | ||
* | ||
* @extends {Data} | ||
*/ | ||
interface SatisfiesAssertionData extends Data {} | ||
interface SatisfiesExpressionData extends Data {} | ||
|
||
/** | ||
* A `satisfies` assertion. | ||
* A `satisfies` expression. | ||
* | ||
* @see {@linkcode Parent} | ||
* @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html#the-satisfies-operator | ||
* | ||
* @extends {Parent} | ||
*/ | ||
interface SatisfiesAssertion extends Parent { | ||
interface SatisfiesExpression extends Parent { | ||
/** | ||
* List of children. | ||
* | ||
* @see {@linkcode Comments} | ||
* @see {@linkcode Expression} | ||
* @see {@linkcode TypeExpression} | ||
* @see {@linkcode SatisfiesClause} | ||
*/ | ||
children: [ | ||
expression: Expression, | ||
...comments: Comments, | ||
satisfies: TypeExpression | ||
satisfies: SatisfiesClause | ||
] | ||
|
||
/** | ||
* Info from the ecosystem. | ||
* | ||
* @see {@linkcode SatisfiesAssertionData} | ||
* @see {@linkcode SatisfiesExpressionData} | ||
*/ | ||
data?: Optional<SatisfiesAssertionData> | ||
data?: Optional<SatisfiesExpressionData> | ||
|
||
/** | ||
* Node type. | ||
*/ | ||
type: 'satisfiesAssertion' | ||
type: 'satisfiesExpression' | ||
} | ||
|
||
export type { SatisfiesAssertionData, SatisfiesAssertion as default } | ||
export type { SatisfiesExpressionData, SatisfiesExpression 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
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,53 @@ | ||
/** | ||
* @file Nodes - SatisfiesClause | ||
* @module esast/nodes/SatisfiesClause | ||
*/ | ||
|
||
import type { | ||
Comments, | ||
Data, | ||
Parent, | ||
TypeExpression | ||
} from '@flex-development/esast' | ||
import type { Optional } from '@flex-development/tutils' | ||
|
||
/** | ||
* Info associated with `satisfies` clauses. | ||
* | ||
* @see {@linkcode Data} | ||
* | ||
* @extends {Data} | ||
*/ | ||
interface SatisfiesClauseData extends Data {} | ||
|
||
/** | ||
* A `satisfies` clause. | ||
* | ||
* @see {@linkcode Parent} | ||
* @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html#the-satisfies-operator | ||
* | ||
* @extends {Parent} | ||
*/ | ||
interface SatisfiesClause extends Parent { | ||
/** | ||
* List of children. | ||
* | ||
* @see {@linkcode Comments} | ||
* @see {@linkcode TypeExpression} | ||
*/ | ||
children: [...comments: Comments, type: TypeExpression] | ||
|
||
/** | ||
* Info from the ecosystem. | ||
* | ||
* @see {@linkcode SatisfiesClauseData} | ||
*/ | ||
data?: Optional<SatisfiesClauseData> | ||
|
||
/** | ||
* Node type. | ||
*/ | ||
type: 'satisfiesClause' | ||
} | ||
|
||
export type { SatisfiesClauseData, SatisfiesClause as default } |