Use an ambient module
suggest changeIf 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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents