mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-03 23:42:50 +00:00
Add types for json2mq
This commit is contained in:
parent
5f59f3dc7a
commit
2e787df3c7
14
types/json2mq/index.d.ts
vendored
Normal file
14
types/json2mq/index.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// Type definitions for json2mq 0.2
|
||||
// Project: https://github.com/akiran/json2mq
|
||||
// Definitions by: Zhang Yi Jiang <https://github.com/ZhangYiJiang>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = json2mq;
|
||||
|
||||
declare function json2mq(query: json2mq.QueryObject | json2mq.QueryObject[]): string;
|
||||
|
||||
declare namespace json2mq {
|
||||
interface QueryObject {
|
||||
[property: string]: string | number | boolean;
|
||||
}
|
||||
}
|
||||
25
types/json2mq/json2mq-tests.ts
Normal file
25
types/json2mq/json2mq-tests.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import * as json2mq from 'json2mq';
|
||||
|
||||
json2mq({ screen: true }); // -> 'screen'
|
||||
|
||||
json2mq({ handheld: false }); // -> 'not handheld'
|
||||
|
||||
json2mq({ minWidth: 100, maxWidth: 200 });
|
||||
// -> '(min-width: 100px) and (max-width: 200px)'
|
||||
|
||||
json2mq({ minWidth: 100, maxWidth: '20em' });
|
||||
// -> '(min-width: 100px) and (max-width: 20em)'
|
||||
|
||||
json2mq([{ screen: true, minWidth: 100 }, { handheld: true, orientation: 'landscape' }]);
|
||||
// -> 'screen and (min-width: 100px), handheld and (orientation: landscape)'
|
||||
|
||||
json2mq({ all: true, monochrome: true });
|
||||
// -> 'all and monochrome'
|
||||
|
||||
// Test QueryObject
|
||||
const mediaQuery: json2mq.QueryObject = {
|
||||
screen: true,
|
||||
monochrome: false,
|
||||
maxWidth: 200,
|
||||
minHeight: '10rem',
|
||||
};
|
||||
23
types/json2mq/tsconfig.json
Normal file
23
types/json2mq/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"json2mq-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/json2mq/tslint.json
Normal file
1
types/json2mq/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user