Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(ast-spec): extractAssignmentOperatorToText#3570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bradzacher merged 3 commits intotypescript-eslint:mainfromMichaelDeBoey:patch-20
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
import type { SyntaxKind } from 'typescript';

export interface AssignmentOperatorToText {
[SyntaxKind.EqualsToken]: '=';
[SyntaxKind.PlusEqualsToken]: '+=';
[SyntaxKind.MinusEqualsToken]: '-=';
[SyntaxKind.AsteriskEqualsToken]: '*=';
[SyntaxKind.AsteriskAsteriskEqualsToken]: '**=';
[SyntaxKind.SlashEqualsToken]: '/=';
[SyntaxKind.PercentEqualsToken]: '%=';
[SyntaxKind.LessThanLessThanEqualsToken]: '<<=';
[SyntaxKind.GreaterThanGreaterThanEqualsToken]: '>>=';
[SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: '>>>=';
[SyntaxKind.AmpersandEqualsToken]: '&=';
[SyntaxKind.BarEqualsToken]: '|=';
[SyntaxKind.BarBarEqualsToken]: '||=';
[SyntaxKind.AmpersandAmpersandEqualsToken]: '&&=';
[SyntaxKind.QuestionQuestionEqualsToken]: '??=';
[SyntaxKind.CaretEqualsToken]: '^=';
}
22 changes: 5 additions & 17 deletionspackages/ast-spec/src/expression/AssignmentExpression/spec.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
import type { AST_NODE_TYPES } from '../../ast-node-types';
import type { BaseNode } from '../../base/BaseNode';
import type { Expression } from '../../unions/Expression';
import type { ValueOf } from '../../utils';
import type { AssignmentOperatorToText } from './AssignmentOperatorToText';

export * from './AssignmentOperatorToText';

export interface AssignmentExpression extends BaseNode {
type: AST_NODE_TYPES.AssignmentExpression;
operator:
| '-='
| '??='
| '**='
| '*='
| '/='
| '&&='
| '&='
| '%='
| '^='
| '+='
| '<<='
| '='
| '>>='
| '>>>='
| '|='
| '||=';
operator: ValueOf<AssignmentOperatorToText>;
left: Expression;
right: Expression;
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
import type { SyntaxKind } from 'typescript';

export interface PunctuatorTokenToText {
import type { AssignmentOperatorToText } from '../../expression/AssignmentExpression/AssignmentOperatorToText';

export interface PunctuatorTokenToText extends AssignmentOperatorToText {
[SyntaxKind.OpenBraceToken]: '{';
[SyntaxKind.CloseBraceToken]: '}';
[SyntaxKind.OpenParenToken]: '(';
Expand DownExpand Up@@ -46,20 +48,4 @@ export interface PunctuatorTokenToText {
[SyntaxKind.QuestionQuestionToken]: '??';
[SyntaxKind.BacktickToken]: '`';
[SyntaxKind.HashToken]: '#';
[SyntaxKind.EqualsToken]: '=';
[SyntaxKind.PlusEqualsToken]: '+=';
[SyntaxKind.MinusEqualsToken]: '-=';
[SyntaxKind.AsteriskEqualsToken]: '*=';
[SyntaxKind.AsteriskAsteriskEqualsToken]: '**=';
[SyntaxKind.SlashEqualsToken]: '/=';
[SyntaxKind.PercentEqualsToken]: '%=';
[SyntaxKind.LessThanLessThanEqualsToken]: '<<=';
[SyntaxKind.GreaterThanGreaterThanEqualsToken]: '>>=';
[SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: '>>>=';
[SyntaxKind.AmpersandEqualsToken]: '&=';
[SyntaxKind.BarEqualsToken]: '|=';
[SyntaxKind.BarBarEqualsToken]: '||=';
[SyntaxKind.AmpersandAmpersandEqualsToken]: '&&=';
[SyntaxKind.QuestionQuestionEqualsToken]: '??=';
[SyntaxKind.CaretEqualsToken]: '^=';
}
3 changes: 1 addition & 2 deletionspackages/ast-spec/src/token/PunctuatorToken/spec.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
import type { AST_TOKEN_TYPES } from '../../ast-token-types';
import type { BaseToken } from '../../base/BaseToken';
import type { ValueOf } from '../../utils';
import type { PunctuatorTokenToText } from './PunctuatorTokenToText';

export * from './PunctuatorTokenToText';

type ValueOf<T> = T[keyof T];

export interface PunctuatorToken extends BaseToken {
type: AST_TOKEN_TYPES.Punctuator;
value: ValueOf<PunctuatorTokenToText>;
Expand Down
1 change: 1 addition & 0 deletionspackages/ast-spec/src/utils.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
export type ValueOf<T> = T[keyof T];
10 changes: 10 additions & 0 deletionspackages/ast-spec/tests/AssignmentOperatorToText.type-test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
import type { AssignmentOperator } from 'typescript';

import { AssignmentOperatorToText } from '../src';

type _Test = {
readonly [T in AssignmentOperator]: AssignmentOperatorToText[T];
// If there are any AssignmentOperator members that don't have a corresponding
// AssignmentOperatorToText, then this line will error with "Type 'T' cannot
// be used to index type 'AssignmentOperatorToText'."
};

[8]ページ先頭

©2009-2025 Movatter.jp