Files
DefinitelyTyped/types/knockout.punches/index.d.ts
Mathias Lykkegaard Lorenzen d7b5cd9707 knockout.mapping better strong typing when mapping objects back and forth (#19119)
* Update index.d.ts

removed fromjs overload that no longer exists in latest knockout.mapping, and added much better type safety for "fromJS".

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* Update index.d.ts

* fix for typescript version.

* more typescript versioning fixes.

* fix for minor bug.

* yet another test fix.

* yet another test fix.
2017-11-15 11:12:34 +00:00

49 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Type definitions for knockout.punches 0.5.1
// Project: https://github.com/mbest/knockout.punches
// Definitions by: Stephen Lautier <https://github.com/johnnyreilly>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="knockout" />
interface KnockoutPunchesStatic {
enableAll(): void;
}
interface KnockoutPunchesFilters {
// Convert the value to uppercase.
uppercase(value: string): string;
// Convert the value to lowercase.
lowercase(value: string): string;
// Perform a search and replace on the value using String#replace.
replace(value: string, search: string, replace: string): string;
// Trim the value if its longer than the given length. The trimmed portion is
// replaced with ... or the replacement value, if given. By default, the value
// is trimmed on the right but can be changed to left or middle through the
// where option. For example: name | fit:10::'middle' will
// convert Shakespeare to Shak...are.
fit(value: number | string, length?: number, replacement?: string, trimWhere?: string): string;
// Convert the value to a JSON string using ko.toJSON. You can give a space value to format the JSON output.
json(rootObject: any, space?: any, replacer?: any): string;
// Format the value using toLocaleString.
number(value: number | string): string;
// If the value is blank, null, or an empty array, replace it with the given default value
default(value: any, defaultValue?: any): any;
}
interface KnockoutStatic {
punches: KnockoutPunchesStatic;
filters: KnockoutPunchesFilters;
}
declare module "knockout.punches" {
export = punches;
}
declare var punches: KnockoutPunchesStatic;