How to extract interface from class, exact match
Open
feature request
Typing: destructors
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
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'})
```
Contributor guide
Assessment
This issue has not been assessed yet.