mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
season: new typings (#29606)
This commit is contained in:
parent
f2d8c72ea3
commit
19f1f4b082
33
types/season/index.d.ts
vendored
Normal file
33
types/season/index.d.ts
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
// Type definitions for season 6.0
|
||||
// Project: http://atom.github.io/season
|
||||
// Definitions by: Piotr Roszatycki <https://github.com/dex4er>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface ParseOptions {
|
||||
allowDuplicateKeys?: boolean;
|
||||
}
|
||||
|
||||
/** Set the cache directory to use for storing compiled CSON files. */
|
||||
export function setCacheDir(cacheDirectory: string): void;
|
||||
|
||||
/** Convert the object to a CSON string. */
|
||||
export function stringify(object: any): string;
|
||||
|
||||
/** Read the CSON or JSON object at the given path and return it to the callback once it is read and parsed. */
|
||||
export function readFile(objectPath: string, callback: (err: Error | null, object: any) => void): void;
|
||||
export function readFile(objectPath: string, options: ParseOptions, callback: (err: Error | null, object: any) => void): void;
|
||||
|
||||
/** Synchronous version of `CSON.readFile(objectPath, callback)`. */
|
||||
export function readFileSync(objectPath: string, options?: ParseOptions): any;
|
||||
|
||||
/** Write the object to the given path as either JSON or CSON depending on the path's extension. */
|
||||
export function writeFile(objectPath: string, object: any, callback: (err: Error | null) => void): void;
|
||||
|
||||
/** Synchronous version of `CSON.writeFile(objectPath, object, callback)` */
|
||||
export function writeFileSync(objectPath: string, object: any): void;
|
||||
|
||||
/** Is the given path a valid object path? Returns true if the path has a .json or .cson file extension, false otherwise. */
|
||||
export function isObjectPath(objectPath: string): boolean;
|
||||
|
||||
/** Resolve the path to an existent file that has a .json or .cson extension. Returns the path to an existent CSON or JSON file or null if none found. */
|
||||
export function resolve(objectPath: string): string | null;
|
||||
25
types/season/season-tests.ts
Normal file
25
types/season/season-tests.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import * as CSON from "season";
|
||||
|
||||
CSON.setCacheDir("/tmp");
|
||||
|
||||
CSON.stringify({});
|
||||
CSON.stringify("string");
|
||||
CSON.stringify(42);
|
||||
CSON.stringify(true);
|
||||
|
||||
CSON.readFile("input.cson", (err, obj) => {
|
||||
if (err) throw err;
|
||||
const input: any = obj;
|
||||
});
|
||||
|
||||
const input: any = CSON.readFileSync("input.cson");
|
||||
|
||||
CSON.writeFile("output.cson", input, (err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
|
||||
CSON.writeFileSync("output.cson", input);
|
||||
|
||||
const isObjectPath: boolean = CSON.isObjectPath("output.cson");
|
||||
|
||||
const path: string | null = CSON.resolve("output.cson");
|
||||
23
types/season/tsconfig.json
Normal file
23
types/season/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"season-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/season/tslint.json
Normal file
1
types/season/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user