'Module not found: Error: Can't resolve 'trusted-types' in '' angular

getting Module not found:

Error: Can't resolve 'trusted-types' installed trusted types using this command npm i @types/trusted-types --force. and npm install trusted-types --save.

Still getting the same error but I can see trusted types inside node_modules/@types folder. below code is how I am using trusted types in code.

import { trustedTypes } from 'trusted-types';
    function createDefaultTrustedType(){
        trustedTypes.createPolicy('default', {
            createHTML: (s) => { 
                return DOMPurify.sanitize(s)
             }
        });
    }


Solution 1:[1]

Sometimes the editor is laggy and doesn't recognize a package. For me a reopen solves.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AndyNope