TypeScript typings give me "index.d.ts is not a module"

You probably want to add

"types": ["webrtc"]

to your tsconfig.json, or less preferrably, to use

/// <reference types="webrtc" />

in your source files. Here's an example of it in your tsconfig.json:

{
    "compilerOptions": {
        "target": "es5",
        "sourceMap": true,
        "noImplicitAny": true,

        "types": ["webrtc"]
    },
    "exclude": [
        "node_modules"
    ]
}

This tells TypeScript it should include webrtc declarations in your build


webrtc is part of the browser; you're trying to import a module. Simply import the (typings) library:

import "webrtc";

you may need to use "moduleResolution": "node" in the compiler options.

Alternatively use the "types": ["webrtc"] compiler option and the compiler will automatically load those types up for you.


In vscode

Ctrl + Shift + p > Developer: Reload Window