How to extract interface from class, exact match
Aperta
feature request
Typing: destructors
- Lingua principale
- Rust
- Stelle
- 22.3k
- Fork
- 1.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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'})
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.