0
は、活字体のlib.d.ts
で、次のインターフェイスを考えてみましょう:インターフェイスから非読み取り専用フィールドのみを選択するにはどうすればよいですか?
interface HTMLElement extends Element {
accessKey: string;
readonly children: HTMLCollection;
contentEditable: string;
readonly dataset: DOMStringMap;
dir: string;
draggable: boolean;
// ... many more
}
私は(下記に示すように)手動でそれらすべてを識別し、入力しなくても、readonly
ではありません。このインタフェースのうちプロパティのみを選ぶだろうか?
type WriteableHTMLElProps = Pick<HTMLElement, "accessKey"|"contentEditable" /* ... */>
注:適切な解決策は、もこれが延びるインターフェイスの非readonly
特性を処理します。