Overloding methods in class without `declare`
Đang mở
feature request
Typing: unions/intersections
- Ngôn ngữ chính
- Rust
- Star
- 22.3k
- Fork
- 1.9k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Using `declare` we can overload methods in classes:
``` js
declare class Foo {
bar(a: number, b: string): number;
bar(b: string): number;
}
```
But is it possible without `declare`?
Here is a not working example just to illustrate what I mean:
``` js
class Foo {
bar(a: number, b: string): number;
bar(b: string): number;
bar(aOrB, maybeB) {
return maybeB !== undefined ? maybeB : aOrB;
}
}
```
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.