mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-27 00:15:09 +08:00
Merge more from types-2.0 to `master (#13770)
* Add memoizee definitions * Fix common issues, added doc * Removed blank line * fix test * Fix test methods * Fix check style * Fix check style * Fixing semver header * Fixing semver header * `memoizee`: Clean up types * Types 2.0 - Fix JS-quantities (#12739) * Enable strict null checking per readme FAQ. * Add tslint.json. * Improve test file with project spec. * Fix js-quantities d.ts, with adjustment of test. * Add trailing newline to tslint. * Simplify functional interface per linter. * js-quantities: add readme examples to tests * js-quantities: fix & clean declaration * d3-selection: Mark before param of insert() as optional (#13090) Selection<etc>.insert functions perfectly well without a `before` selector -- it does so in many d3 official examples. This corrects the type signature to mark it as optional. * [react-intl] bugfix for #12716 (#12906) * fix for issue introduced in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/12716 * injectIntl is now usable as class decorator * fixed test * use inferface instead of type * format document * fix chai-json-schema styling (#13537) * googlemaps: Allow Marker.setAnimation(null) and Marker.setMap(null) (#13240) * googlemaps: Allow Marker.setAnimation(null) * Also, turn on strictNullChecks * Allow new google.maps.Map(null) since it's technically possible with Google's example code from the docs Signed-off-by: Iqbal Yusuf <iyusuf@corelogic.com> * googlemaps: Allow Marker.setMap(null) * Also, add more test code from the Google Maps API documentation Signed-off-by: Grant Hutchins <ghutchins@pivotal.io> * Added the brand property to the StripeCardData and fix style issues, lint (#13084) * Add the "brand" field to StipeCardData Added the StipeCardDataBrand type. Added the `brand` property to the `StripeCardData` declaration with the type `'Visa' | 'American Express' | 'MasterCard' | 'Discover JCB' | 'Diners Club' | 'Unknown'` Reference: https://stripe.com/docs/api#card_object * Run linter, fix issues. set --strictNullChecks. Unsure about ambient declaration: Removed as it seemed to be in error: 1. case was not correct 2. the export was the type of the global which is unconditionally defined. 3. this module does not seem a suitable candidate for a UMD declaration. * Use header version of 0.0; explain Stripe versioning in comments * Restore global * Added tests
This commit is contained in:
132
js-quantities/index.d.ts
vendored
132
js-quantities/index.d.ts
vendored
@@ -1,79 +1,73 @@
|
||||
// Type definitions for JS-quantities
|
||||
// Type definitions for JS-quantities 1.6
|
||||
// Project: http://gentooboontoo.github.io/js-quantities/
|
||||
// Definitions by: William Comartin <https://github.com/wcomartin>
|
||||
// Definitions by: William Rummler <https://github.com/wrummler>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var Qty: QtyModule.QtyStatic;
|
||||
|
||||
declare namespace QtyModule {
|
||||
interface QtyStatic {
|
||||
(value: string): Qty;
|
||||
(value: number): Qty;
|
||||
(value: number, unit: string): Qty;
|
||||
(value: Qty): Qty;
|
||||
}
|
||||
|
||||
interface Qty {
|
||||
version: string;
|
||||
|
||||
scalar: number;
|
||||
baseScalar: number;
|
||||
|
||||
parse(value: string): Qty;
|
||||
|
||||
swiftConverter(srcUnits:string, dstUnits:string): (value:number) => number;
|
||||
|
||||
getkinds(): string[];
|
||||
|
||||
getUnits(kind:string): string[];
|
||||
|
||||
getAliases(unitName:string): string[];
|
||||
|
||||
formatter(scalar:number, units:string):string;
|
||||
|
||||
toFloat(): number;
|
||||
|
||||
isUnitless(): boolean;
|
||||
|
||||
isCompatible(other:string|Qty): boolean;
|
||||
|
||||
isInverse(other:string|Qty): boolean
|
||||
|
||||
kind(): string;
|
||||
|
||||
isBase(): boolean;
|
||||
|
||||
toBase(): Qty;
|
||||
declare const Qty: Qty.Type;
|
||||
|
||||
declare interface Qty {
|
||||
readonly numerator: string[];
|
||||
readonly denominator: string[];
|
||||
readonly scalar: number;
|
||||
readonly baseScalar: number;
|
||||
readonly initValue: string;
|
||||
units(): string;
|
||||
|
||||
eq(other:Qty): boolean;
|
||||
lt(other:Qty): boolean;
|
||||
lte(other:Qty): boolean;
|
||||
gt(other:Qty): boolean;
|
||||
gte(other:Qty): boolean;
|
||||
|
||||
toPrec(precQuantity: Qty|string|number): Qty;
|
||||
|
||||
toString(targetUnitsOrMaxDecimalsOrPrec?:number|string|Qty, maxDecimals?: number): string;
|
||||
|
||||
format(targetUnits?:string, formatter?:(scalar:number, units:string) => string): string;
|
||||
|
||||
compareTo(other:Qty|string): number;
|
||||
|
||||
same(other: Qty): boolean;
|
||||
|
||||
isCompatible(value: Qty.UnitSource): boolean;
|
||||
kind(): string;
|
||||
isUnitless(): boolean;
|
||||
isBase(): boolean;
|
||||
toBase(): Qty;
|
||||
toFloat(): number;
|
||||
to(value: Qty.UnitSource): Qty;
|
||||
inverse(): Qty;
|
||||
eq(value: Qty.UnitSource): boolean;
|
||||
same(value: Qty.UnitSource): boolean;
|
||||
lt(value: Qty.UnitSource): boolean;
|
||||
lte(value: Qty.UnitSource): boolean;
|
||||
gt(value: Qty.UnitSource): boolean;
|
||||
gte(value: Qty.UnitSource): boolean;
|
||||
compareTo(value: Qty): Qty.ComparisonResult;
|
||||
add(value: Qty.Source): Qty;
|
||||
sub(value: Qty.Source): Qty;
|
||||
mul(value: Qty.Source): Qty;
|
||||
div(value: Qty.Source): Qty;
|
||||
toPrec(value: Qty.Source): Qty;
|
||||
toString(valueOrPrecision?: Qty.Source): string;
|
||||
toString(value: string, precision: number): string;
|
||||
format(formatter?: Qty.Formatter): string;
|
||||
format(value: string, formatter?: Qty.Formatter): string;
|
||||
}
|
||||
|
||||
isDegrees(): boolean;
|
||||
declare namespace Qty {
|
||||
|
||||
isTemperature(): boolean;
|
||||
interface Type {
|
||||
(value: Source): Qty;
|
||||
(value: number, unit: string): Qty;
|
||||
new (value: Source): Qty;
|
||||
new (value: number, unit: string): Qty;
|
||||
parse(value: string): Qty;
|
||||
getKinds(): string[];
|
||||
getUnits(kind?: string): string[];
|
||||
getAliases(unit: string): string[];
|
||||
swiftConverter(sourceUnit: string, targetUnit: string): Converter;
|
||||
formatter: Formatter;
|
||||
readonly Error: any;
|
||||
mulSafe(n1: number, n2: number): number;
|
||||
divSafe(n1: number, n2: number): number;
|
||||
}
|
||||
|
||||
to(other:string|Qty): Qty;
|
||||
interface Converter {
|
||||
(sourceValue: number): number;
|
||||
(sourceValues: number[]): number[];
|
||||
}
|
||||
|
||||
add(other:string|Qty): Qty;
|
||||
sub(other:string|Qty): Qty;
|
||||
mul(other:number|string|Qty): Qty;
|
||||
div(other:number|string|Qty): Qty;
|
||||
}
|
||||
}
|
||||
type Formatter = (scalar: number, unit: string) => string;
|
||||
|
||||
type ComparisonResult = -1 | 0 | 1;
|
||||
|
||||
type Source = UnitSource | number;
|
||||
|
||||
type UnitSource = Qty | string;
|
||||
}
|
||||
|
||||
export default Qty;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -17,4 +17,4 @@
|
||||
"index.d.ts",
|
||||
"js-quantities-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
3
js-quantities/tslint.json
Normal file
3
js-quantities/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
Reference in New Issue
Block a user