TypeScript How to use a javascript library without a type definition file Use an ambient module


Example

If you just want to indicate the intent of an import (so you don't want to declare a global) but don't wish to bother with any explicit definitions, you can import an ambient module.

// in a declarations file (like declarations.d.ts)
declare module "jquery";    // note that there are no defined exports

You can then import from the ambient module.

// some other .ts file
import {$, jQuery} from "jquery";

Anything imported from the declared module (like $ and jQuery) above will be of type any