Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quotesy #51764

Merged
merged 5 commits into from
Mar 16, 2021
Merged

Quotesy #51764

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions types/quotesy/index.d.ts
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;
natesilva marked this conversation as resolved.
Show resolved Hide resolved
/** Comma-separated list of words associated with the quote */
tags?: string;
/** A URL where the origin of the quote can be verified */
source?: string;
}
5 changes: 5 additions & 0 deletions types/quotesy/quotesy-tests.ts
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
23 changes: 23 additions & 0 deletions types/quotesy/tsconfig.json
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"
]
}
1 change: 1 addition & 0 deletions types/quotesy/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }