How to extract interface from class, exact match
Abierto
feature request
Typing: destructors
- Lenguaje dominante
- Rust
- Estrellas
- 22.3k
- Forks
- 1.9k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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'})
```
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.