How to extract interface from class, exact match
Đang mở
feature request
Typing: destructors
- 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ả
How to extract properties interface from class and do exact match?
```js
class A {
a: string
}
const likeA: $ShapeWithExactMatch = {} // need a: string
```
I try $Shape, but it do not exact match.
EDIT: Full example
```js
export default class A {
some: string
constructor]: string}>(rec?: K, old?: K) {
Object.assign(this, this.constructor.defaults, rec, old)
}
copy(rec: {[_: $Keys]: string}): this {
return new this.constructor(rec, this)
}
static defaults = {
some: 'default'
}
}
const a = new A({some: 'test'})
const b = a.copy({info: 'qq'})
```
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.