diff --git a/types/jquery.pin/index.d.ts b/types/jquery.pin/index.d.ts new file mode 100644 index 0000000000..df132c6571 --- /dev/null +++ b/types/jquery.pin/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for JQuery Pin 1.0 +// Project: https://github.com/webpop/jquery.pin +// Definitions by: Anderson Friaça +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +export interface Options { + minWidth?: number; + activeClass?: string; + containerSelector?: string; + padding?: { + top?: number; + bottom?: number; + }; +} +declare global { + interface JQuery { + pin(options?: Options): JQuery; + } +} diff --git a/types/jquery.pin/jquery.pin-tests.ts b/types/jquery.pin/jquery.pin-tests.ts new file mode 100644 index 0000000000..b43c6e7881 --- /dev/null +++ b/types/jquery.pin/jquery.pin-tests.ts @@ -0,0 +1,17 @@ +import { Options } from "jquery.pin"; + +// basic usage +$(".pinned").pin(); + +// with options +const options: Options = { + activeClass: 'active', + minWidth: 940, + containerSelector: '.container', + padding: { + top: 10, + bottom: 10 + } +}; + +$(".pinned").pin(options); diff --git a/types/jquery.pin/tsconfig.json b/types/jquery.pin/tsconfig.json new file mode 100644 index 0000000000..4e880d5205 --- /dev/null +++ b/types/jquery.pin/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "jquery.pin-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jquery.pin/tslint.json b/types/jquery.pin/tslint.json new file mode 100644 index 0000000000..d04fe2e1fa --- /dev/null +++ b/types/jquery.pin/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} \ No newline at end of file