microsoft / microsoft/TypeScript

Syntax error in a union type which contains a callback type

オープン
#37,637 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Experience Enhancement Suggestion
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

TypeScript Version: 3.8.3

Search Terms:

  • algebraic data types

Expected behavior:
Both b and c definitions are correct
Actual behavior:
Syntax errors:

Texts of errors (from left to right)

Exported variable 'c' has or is using private name ''.(4025)
Type expected.(1110)
';' expected.(1005)
'(' expected.(1005)

Related Issues:

Code

type ArrFunc = () => Array<number>;
let b: Array<number> | number | ArrFunc;
let c: Array<number> | number | () => Array<number>;
Output
"use strict";
let b;
let c;
Array();

Compiler Options
{
  "compilerOptions": {
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "useDefineForClassFields": false,
    "alwaysStrict": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "downlevelIteration": false,
    "noEmitHelpers": false,
    "noLib": false,
    "noStrictGenericChecks": false,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "esModuleInterop": true,
    "preserveConstEnums": false,
    "removeComments": false,
    "skipLibCheck": false,
    "checkJs": false,
    "allowJs": false,
    "declaration": true,
    "experimentalDecorators": false,
    "emitDecoratorMetadata": false,
    "target": "ES2017",
    "module": "ESNext"
  }
}

Playground Link: Provided

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンク先の Playground または指定された TypeScript 3.8.3 バージョンを使用して、提供された b と c の TypeScript 定義で報告された構文エラーを再現します。c の直接的な callback 型と、b の名前付き ArrFunc 形式を比較します。両方の定義が報告されたエラーなしでコンパイルされ、既存のコンパイラの動作が引き続き回帰テストでカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。