-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
547 additions
and
35 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
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,23 @@ | ||
import { freeze } from '../util/object-utils.js' | ||
import { OperationNode } from './operation-node.js' | ||
|
||
export interface TupleNode extends OperationNode { | ||
readonly kind: 'TupleNode' | ||
readonly values: ReadonlyArray<OperationNode> | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const TupleNode = freeze({ | ||
is(node: OperationNode): node is TupleNode { | ||
return node.kind === 'TupleNode' | ||
}, | ||
|
||
create(values: ReadonlyArray<OperationNode>): TupleNode { | ||
return freeze({ | ||
kind: 'TupleNode', | ||
values: freeze(values), | ||
}) | ||
}, | ||
}) |
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,73 @@ | ||
import { ExtractTypeFromReferenceExpression } from './reference-parser.js' | ||
import { ExtractTypeFromValueExpression } from './value-parser.js' | ||
|
||
export type RefTuple2<DB, TB extends keyof DB, R1, R2> = [R1] extends [unknown] | ||
? [ | ||
ExtractTypeFromReferenceExpression<DB, TB, R1>, | ||
ExtractTypeFromReferenceExpression<DB, TB, R2> | ||
] | ||
: never | ||
|
||
export type RefTuple3<DB, TB extends keyof DB, R1, R2, R3> = [R1] extends [ | ||
unknown | ||
] | ||
? [ | ||
ExtractTypeFromReferenceExpression<DB, TB, R1>, | ||
ExtractTypeFromReferenceExpression<DB, TB, R2>, | ||
ExtractTypeFromReferenceExpression<DB, TB, R3> | ||
] | ||
: never | ||
|
||
export type RefTuple4<DB, TB extends keyof DB, R1, R2, R3, R4> = [R1] extends [ | ||
unknown | ||
] | ||
? [ | ||
ExtractTypeFromReferenceExpression<DB, TB, R1>, | ||
ExtractTypeFromReferenceExpression<DB, TB, R2>, | ||
ExtractTypeFromReferenceExpression<DB, TB, R3>, | ||
ExtractTypeFromReferenceExpression<DB, TB, R4> | ||
] | ||
: never | ||
|
||
export type RefTuple5<DB, TB extends keyof DB, R1, R2, R3, R4, R5> = [ | ||
R1 | ||
] extends [unknown] | ||
? [ | ||
ExtractTypeFromReferenceExpression<DB, TB, R1>, | ||
ExtractTypeFromReferenceExpression<DB, TB, R2>, | ||
ExtractTypeFromReferenceExpression<DB, TB, R3>, | ||
ExtractTypeFromReferenceExpression<DB, TB, R4>, | ||
ExtractTypeFromReferenceExpression<DB, TB, R5> | ||
] | ||
: never | ||
|
||
export type ValTuple2<V1, V2> = [V1] extends [unknown] | ||
? [ExtractTypeFromValueExpression<V1>, ExtractTypeFromValueExpression<V2>] | ||
: never | ||
|
||
export type ValTuple3<V1, V2, V3> = V1 extends any | ||
? [ | ||
ExtractTypeFromValueExpression<V1>, | ||
ExtractTypeFromValueExpression<V2>, | ||
ExtractTypeFromValueExpression<V3> | ||
] | ||
: never | ||
|
||
export type ValTuple4<V1, V2, V3, V4> = [V1] extends [unknown] | ||
? [ | ||
ExtractTypeFromValueExpression<V1>, | ||
ExtractTypeFromValueExpression<V2>, | ||
ExtractTypeFromValueExpression<V3>, | ||
ExtractTypeFromValueExpression<V4> | ||
] | ||
: never | ||
|
||
export type ValTuple5<V1, V2, V3, V4, V5> = [V1] extends [unknown] | ||
? [ | ||
ExtractTypeFromValueExpression<V1>, | ||
ExtractTypeFromValueExpression<V2>, | ||
ExtractTypeFromValueExpression<V3>, | ||
ExtractTypeFromValueExpression<V4>, | ||
ExtractTypeFromValueExpression<V5> | ||
] | ||
: never |
Oops, something went wrong.