How to add IntelliSense in monaco editor for mustache library

30 Views Asked by At

I am importing types using raw loader. I am not sure how I can import typescript definition for mustache and how to pass it to monaco editor using "addExtraLib" function

Here are code snippets -

import MUSTACHE from '!raw-loader!@types/mustache';
.......
....
monaco.languages.typescript.javascriptDefaults.addExtraLib(
        MUSTACHE,
        '@types/mustache/index.d.ts'
      );
      
      
      
// mustache package's package.json file have forllowing exports configuration
"exports": {
        "./package.json": "./package.json",
        ".": {
            "types": {
                "import": "./index.d.mts",
                "default": "./index.d.ts"
            }
        }
    },

Here is package.json file of @types/mustache package https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/mustache/package.json

0

There are 0 best solutions below