Enhance: TypeScriptの型を厳格化 by takejohn · Pull Request #891 · aiscript-dev/aiscript

Skip to content

Navigation Menu

Sign in

Appearance settings

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

Conversation

@takejohn

Copy link

Member

What

  • as!による型アサーションを減らします。
  • CharStreameofcharがgetterであるために意図しないnarrowingが発生していたので通常のメソッドに変更します。
  • パーサのプラグインで用いるvisitNode関数にジェネリクスを使用します。
  • Ast.Forの型を変更し、(varおよびfrom, to)またはtimesのどちらかが必須となるようにします。
  • Tokenの型を変更し、識別子やリテラルの場合はvalueを、テンプレートリテラルの場合はchildrenを必須にします。

Why

Resolve #880

Additional info (optional)

@codecov-commenter

Copy link

codecov-commenter commented

Dec 31, 2024

edited

Loading

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 98.93238% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/error.ts 66.66% 2 Missing ⚠️
src/interpreter/index.ts 96.96% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files with missing lines Coverage Δ
src/interpreter/primitive-props.ts 98.07% <100.00%> (+0.09%) ⬆️
src/interpreter/scope.ts 93.69% <100.00%> (+3.15%) ⬆️
src/node.ts 85.71% <ø> (-12.66%) ⬇️
src/parser/plugins/validate-jump-statements.ts 100.00% <100.00%> (ø)
src/parser/plugins/validate-keyword.ts 95.67% <100.00%> (+7.06%) ⬆️
src/parser/plugins/validate-type.ts 100.00% <100.00%> (+17.64%) ⬆️
src/parser/scanner.ts 95.22% <100.00%> (+6.46%) ⬆️
src/parser/streams/char-stream.ts 90.47% <100.00%> (+1.98%) ⬆️
src/parser/streams/token-stream.ts 79.62% <ø> (+16.18%) ⬆️
src/parser/syntaxes/common.ts 96.82% <100.00%> (+7.29%) ⬆️
... and 9 more

... and 13 files with indirect coverage changes

Co-authored-by: salano_ym <53254905+salano-ym@users.noreply.github.com>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@salano-ym salano-ym salano-ym left review comments

@FineArchs FineArchs FineArchs approved these changes

@syuilo syuilo Awaiting requested review from syuilo

@uzmoi uzmoi Awaiting requested review from uzmoi

@kakkokari-gtyih kakkokari-gtyih Awaiting requested review from kakkokari-gtyih

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

TypeScriptの型を考え直す

5 participants

@takejohn @codecov-commenter @salano-ym @kakkokari-gtyih @FineArchs