microsoft / microsoft/TypeScript
Existential type?
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
Here's a case where I need a few existentials. It's for a definition file, where I need to have parameters for Binding and Scheduler, but it doesn't matter to me what they are. All I care about is that they're internally correct (and any doesn't cover this), and I'd rather not simulate it by making the constructor unnecessarily generic.
The alternative for me is to be able to declare additional constructor-specific type parameters that don't carry to other methods, but existentials would make it easier.
export interface Scheduler<Frame, Idle> {
nextFrame(func: () => any): Frame;
cancelFrame(frame: Frame): void;
nextIdle(func: () => any): Idle;
cancelIdle(frame: Idle): void;
nextTick(func: () => any): void;
}
export interface Binding<E> extends Component {
binding: E;
patchEnd?(): void;
patchAdd?(
prev: string | E | void,
next: string | E | void,
pos: number,
): void;
patchRemove?(
prev: string | E | void,
next: string | E | void,
pos: number
): void;
patchChange?(
oldPrev: string | E | void,
newPrev: string | E | void,
oldNext: string | E | void,
newNext: string | E | void,
oldPos: number,
newPos: number
): void;
}
export class Subtree {
constructor(
onError?: (err: Error) => any,
scheduler?: type<F, I> Scheduler<F, I>
);
// ...
}
export class Root extends Subtree {
constructor(
component: type<E> Binding<E>,
onError?: (err: Error) => any,
scheduler?: type<F, I> Scheduler<F, I>
);
// ...
}
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Issue にある existential type の例から始めてください。ソースファイル、テスト、エントリポイントのいずれも指定されていないため、設計を評価する前に、関係する TypeScript の型システムと宣言処理の領域を特定してください。完了の条件は、Binding 型と Scheduler 型の内部関係を維持しながら、要求された existential parameter をサポートすることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100