jQuery.json的TypeScript声明文件(jquery.json.d.ts)

因用TypeScript时,NuGet没有jquery.json的声明文件下载,自己写了一个。分享一下。

interface JQueryStatic {
    /**
     * Converts the given argument into a JSON representation.
     *
     * @param o {Mixed} The json-serializable *thing* to be converted
     *
     * If an object has a toJSON prototype, that will be used to get the representation.
     * Non-integer/string keys are skipped in the object, as are keys that point to a
     * function.
     *
     */
    toJSON(o: any): string;

    /**
     * Evaluates a given json string.
     *
     * @param str {String}
     */
    evalJSON(str: string): boolean;

    /**
     * Evals JSON in a way that is *more* secure.
     *
     * @param str {String}
     */
    secureEvalJSON(str: string): boolean;

    /**
     * Returns a string-repr of a string, escaping quotes intelligently.
     * Mostly a support function for toJSON.
     * Examples:
     * >>> jQuery.quoteString('apple')
     * "apple"
     *
     * >>> jQuery.quoteString('"Where are we going?", she asked.')
     * "\"Where are we going?\", she asked."
     */
    quoteString(str: string): string;
}

 

posted on 2016-11-02 11:00  BadTree  阅读(2194)  评论(0编辑  收藏  举报