-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [quotesy] add types for quotesy 1.0 * [quotesy] clean up doc comments * add tags and source properties to Quote Co-authored-by: Nelson <194400+nelsonic@users.noreply.github.com> * [quotesy] make tags, source optional; update docs Co-authored-by: Nelson <194400+nelsonic@users.noreply.github.com>
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Type definitions for quotesy 1.0 | ||
// Project: https://github.com/dwyl/quotes#readme | ||
// Definitions by: Nate Silva <https://github.com/natesilva> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
/** | ||
* Returns an Array of Quote Objects | ||
*/ | ||
export function parse_json(): Quote[]; | ||
|
||
/** | ||
* Returns a random quote from the list | ||
*/ | ||
export function random(): Quote; | ||
|
||
/** | ||
* Returns a random quote for a specific tag | ||
* @param tag the tag to search for | ||
*/ | ||
export function random_by_tag(tag: string): Quote; | ||
|
||
/** A single quote from the database */ | ||
export interface Quote { | ||
/** The author of the quote */ | ||
author: string; | ||
/** The text of the quote */ | ||
text: string; | ||
/** Comma-separated list of words associated with the quote */ | ||
tags?: string; | ||
/** A URL where the origin of the quote can be verified */ | ||
source?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import quotesy = require("quotesy"); | ||
|
||
quotesy.parse_json(); // $ExpectType Quote[] | ||
quotesy.random(); // $ExpectType Quote | ||
quotesy.random_by_tag(""); // $ExpectType Quote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
"quotesy-tests.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "extends": "dtslint/dt.json" } |