aiscript
aiscript copied to clipboard
Enhance: TypeScriptの型を厳格化
What
asや!による型アサーションを減らします。CharStreamのeofやcharがgetterであるために意図しないnarrowingが発生していたので通常のメソッドに変更します。- パーサのプラグインで用いる
visitNode関数にジェネリクスを使用します。 Ast.Forの型を変更し、(varおよびfrom,to)またはtimesのどちらかが必須となるようにします。Tokenの型を変更し、識別子やリテラルの場合はvalueを、テンプレートリテラルの場合はchildrenを必須にします。
Why
Resolve #880
Additional info (optional)
:warning: Please install the 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 :warning: |
| src/interpreter/index.ts | 96.96% | 1 Missing :warning: |
:exclamation: 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%) |
:arrow_up: |
| src/interpreter/scope.ts | 93.69% <100.00%> (+3.15%) |
:arrow_up: |
| src/node.ts | 85.71% <ø> (-12.66%) |
:arrow_down: |
| src/parser/plugins/validate-jump-statements.ts | 100.00% <100.00%> (ø) |
|
| src/parser/plugins/validate-keyword.ts | 95.67% <100.00%> (+7.06%) |
:arrow_up: |
| src/parser/plugins/validate-type.ts | 100.00% <100.00%> (+17.64%) |
:arrow_up: |
| src/parser/scanner.ts | 95.22% <100.00%> (+6.46%) |
:arrow_up: |
| src/parser/streams/char-stream.ts | 90.47% <100.00%> (+1.98%) |
:arrow_up: |
| src/parser/streams/token-stream.ts | 79.62% <ø> (+16.18%) |
:arrow_up: |
| src/parser/syntaxes/common.ts | 96.82% <100.00%> (+7.29%) |
:arrow_up: |
| ... and 9 more |