doc_components icon indicating copy to clipboard operation
doc_components copied to clipboard

Inferring public properties from a class's constructor is not supported.

Open masx200 opened this issue 3 years ago • 1 comments

Inferring public properties from a class's constructor is not supported. input :

export class TrieNode {
    constructor(
        public wordCount: number = 0,
        public prefixCount: number = 0,
        public readonly children = new Map<string, TrieNode>(),
    ) {}
}

https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBAYwDYEMDOa4BUoEtgByEAJsHAN4CwAUHHYhAHZoxQCuCM0AFDff3DBsARklwI4Ad2jEAwhDaMYALjiM2AW2HAocALxwADABo+AukNHjBUYADNcIeYpVrN23QZNnzlsRNsUYiYkAE9EAAtcJGJbRn01YEk4AFkUMAAeFjxGAHNjbDxCEmAAPm4ASlNaegqKAF8aRuogA

output:

export declare class TrieNode {
    wordCount: number;
    prefixCount: number;
    readonly children: Map<string, TrieNode>;
    constructor(wordCount?: number, prefixCount?: number, children?: Map<string, TrieNode>);
}

https://doc.deno.land/https://deno.land/x/[email protected]/implement-trie-ii-prefix-tree/TrieNode.ts/~/TrieNode

https://deno.land/x/[email protected]/implement-trie-ii-prefix-tree/TrieNode.ts?source image

masx200 avatar Sep 10 '22 10:09 masx200

I believe the accessor information is in the constructor params, it is a matter though of pulling that out and displaying it.

deno.land/x view: https://deno.land/x/[email protected]/implement-trie-ii-prefix-tree/TrieNode.ts?s=TrieNode

kitsonk avatar Sep 10 '22 20:09 kitsonk