mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-20 21:12:38 +08:00
Modified Mousetrap definition to allow Mousetrap to be loaded as an
external module. - tests are also updated to test loading as an external module - mousetrap exports itself as an AMD module when an AMD define function is present
This commit is contained in:
@@ -41,3 +41,11 @@ Mousetrap.trigger('esc');
|
||||
Mousetrap.trigger('esc', 'keyup');
|
||||
|
||||
Mousetrap.reset();
|
||||
|
||||
// Test that Mousetrap can be loaded as an external module.
|
||||
// Assume that if the externally-loaded module can be assigned to a variable with the type of global Mousetrap,
|
||||
// then everything is working correctly.
|
||||
|
||||
import importedMousetrap = require('mousetrap');
|
||||
var mousetrapModuleReference: typeof Mousetrap = importedMousetrap;
|
||||
|
||||
|
||||
4
mousetrap/mousetrap.d.ts
vendored
4
mousetrap/mousetrap.d.ts
vendored
@@ -19,3 +19,7 @@ interface MousetrapStatic {
|
||||
}
|
||||
|
||||
declare var Mousetrap: MousetrapStatic;
|
||||
|
||||
declare module "mousetrap" {
|
||||
export = Mousetrap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user