Types for JQuery Gray

This commit is contained in:
AndersonFriaca
2018-06-29 13:14:16 -04:00
parent a5b0278214
commit 4df19ddfc1
4 changed files with 65 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for JQuery Gray 1.6
// Project: https://github.com/karlhorky/gray
// Definitions by: Anderson Friaça <https://github.com/AndersonFriaca>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery" />
export type Classes = Partial<{
fade: string;
}>;
export type Options = Partial<{
fade: boolean;
classes: Classes;
}>;
declare global {
interface JQuery {
gray(options?: Options): JQuery;
toggleClass(className: 'grayscale-off'): JQuery;
}
}
+16
View File
@@ -0,0 +1,16 @@
import { Options } from "jquery-gray";
// basic usage
$('.images').gray();
$('.images').toggleClass('grayscale-off');
// with options
const options: Options = {
fade: true,
classes: {
fade: 'grayscale-fade'
}
};
$('.images').gray(options);
+25
View File
@@ -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-gray-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{"extends": "dtslint/dt.json"}