I'm interested in enhancing the type hints available in the monaco editor, such as Object, String, or Boolean, with my own custom type. The ultimate goal is for the editor to recognize this new type and offer code completion specific to it.
Most of the examples I've come across involve inserting strings into addExtraLib
, but I feel that this approach lacks professionalism:
monaco.languages.typescript.javascriptDefaults.addExtraLib([
'declare class MyClass {',
' count: number',
'}'
].join('\n'));
What I really want is to provide a .d.ts file like the one below to inform the editor about my custom type and streamline the process:
// myclass.d.ts
export class MyClass = {
count: number
}
Am I overlooking something important here?