diff --git a/ace/ace.d.ts b/ace/ace.d.ts index 8fed295f2..8694777d3 100644 --- a/ace/ace.d.ts +++ b/ace/ace.d.ts @@ -653,7 +653,7 @@ declare module AceAjax { * @param type Identify the type of the marker * @param inFront Set to `true` to establish a front marker **/ - addMarker(range: Range, clazz: string, type: Function, inFront: boolean): void; + addMarker(range: Range, clazz: string, type: Function, inFront: boolean): number; /** * Adds a new marker to the given `Range`. If `inFront` is `true`, a front marker is defined, and the `'changeFrontMarker'` event fires; otherwise, the `'changeBackMarker'` event fires. @@ -662,7 +662,7 @@ declare module AceAjax { * @param type Identify the type of the marker * @param inFront Set to `true` to establish a front marker **/ - addMarker(range: Range, clazz: string, type: string, inFront: boolean): void; + addMarker(range: Range, clazz: string, type: string, inFront: boolean): number; /** * Adds a dynamic marker to the session. diff --git a/angular-formly/angular-formly.d.ts b/angular-formly/angular-formly.d.ts index 967a16d10..50a71c125 100644 --- a/angular-formly/angular-formly.d.ts +++ b/angular-formly/angular-formly.d.ts @@ -16,32 +16,34 @@ declare module 'angular-formly' { declare module AngularFormly { - interface IFieldArray extends Array { + interface IFieldArray extends Array { - } + } interface IFieldGroup { data?: { - [key: string]: any; - }; + [key: string]: any; + }; className?: string; elementAttributes?: string; - fieldGroup?: IFieldArray; + fieldGroup?: IFieldArray; form?: Object; hide?: boolean; hideExpression?: string | IExpressionFunction; key?: string | number; - model?: string | Object; - options?: IFormOptionsAPI; - templateOptions?: ITemplateOptions; - wrapper?: string | string[]; + model?: string | { + [key: string]: any; + }; + options?: IFormOptionsAPI; + templateOptions?: ITemplateOptions; + wrapper?: string | string[]; } interface IFormOptionsAPI { data?: { - [key: string]: any; - }; + [key: string]: any; + }; fieldTransform?: Function; formState?: Object; removeChromeAutoComplete?: boolean; @@ -182,8 +184,8 @@ declare module AngularFormly { * see http://docs.angular-formly.com/docs/field-configuration-object#data-object */ data?: { - [key: string]: any; - }; + [key: string]: any; + }; /** @@ -287,7 +289,9 @@ declare module AngularFormly { * * see http://docs.angular-formly.com/docs/field-configuration-object#model-object--string */ - model?: Object | string; + model?: string | { + [key: string]: any; + }; /** @@ -543,8 +547,8 @@ declare module AngularFormly { defaultOptions?: IFieldConfigurationObject | Function; controller?: Function | string | any[]; data?: { - [key: string]: any; - }; + [key: string]: any; + }; extends?: string; link?: ng.IDirectiveLinkFn; overwriteOk?: boolean; @@ -612,7 +616,9 @@ declare module AngularFormly { //The index of the field the form is on (in ng-repeat) index: number; //the model of the form (or the model specified by the field if it was specified). - model: Object | string; + model?: string | { + [key: string]: any; + }; //Shortcut to options.validation.errorExistsAndShouldBeVisible showError: boolean; //Shortcut to options.templateOptions diff --git a/angular-load/angular-load-tests.ts b/angular-load/angular-load-tests.ts index b7d7c2e60..7fea2d792 100644 --- a/angular-load/angular-load-tests.ts +++ b/angular-load/angular-load-tests.ts @@ -6,7 +6,7 @@ angular.module('app',['angularLoad']) ()=>console.log("angular material js loaded") ); - angularLoad.loadCss("https://ajax.googleapis.com/ajax/libs/angular_material/1.0.4/angular-material.css").then( + angularLoad.loadCSS("https://ajax.googleapis.com/ajax/libs/angular_material/1.0.4/angular-material.css").then( ()=>console.log("angular material css loaded") ); }]); diff --git a/angular-load/angular-load.d.ts b/angular-load/angular-load.d.ts index 65d5bc388..2a9dc9413 100644 --- a/angular-load/angular-load.d.ts +++ b/angular-load/angular-load.d.ts @@ -9,7 +9,7 @@ declare module angular.load { interface IAngularLoadService { loadScript(url:string): ng.IPromise; - loadCss(url:string): ng.IPromise; + loadCSS(url:string): ng.IPromise; } } diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index d3d627c27..4bcf96d53 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -272,6 +272,9 @@ module TestQ { { let result: angular.IPromise; result = $q.all([promiseAny, promiseAny]); + // TS should infer that n1 and n2 are numbers and have toFixed. + $q.all([1, $q.when(2)]).then(([ n1, n2 ]) => n1.toFixed() + n2.toFixed()); + $q.all([1, $q.when(2), '3']).then(([ n1, n2, n3 ]) => n1.toFixed() + n2.toFixed() + n3.slice(1)); } { let result: angular.IPromise; diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index f655c21c4..38f761ade 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1006,7 +1006,16 @@ declare module angular { * * @param promises An array of promises. */ - all(promises: IPromise[]): IPromise; + all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise, T8 | IPromise, T9 | IPromise, T10 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise, T8 | IPromise, T9 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise, T8 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise, T7 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6, T7]>; + all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise, T6 | IPromise]): IPromise<[T1, T2, T3, T4, T5, T6]>; + all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise , T5 | IPromise]): IPromise<[T1, T2, T3, T4, T5]>; + all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise, T4 | IPromise ]): IPromise<[T1, T2, T3, T4]>; + all(values: [T1 | IPromise, T2 | IPromise, T3 | IPromise]): IPromise<[T1, T2, T3]>; + all(values: [T1 | IPromise, T2 | IPromise]): IPromise<[T1, T2]>; + all(promises: IPromise[]): IPromise; /** * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. * diff --git a/antd/antd.d.ts b/antd/antd.d.ts index 96e473c54..ac23dcdc7 100644 --- a/antd/antd.d.ts +++ b/antd/antd.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Antd v0.12.8 +// Type definitions for Antd v0.12.10 // Project: http://ant.design // Definitions by: bang88 // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -11,42 +11,91 @@ declare namespace Antd { // Affix interface AffixProps extends React.Props { + /** + * 达到指定偏移量后触发 + */ offset?: number } + /** + * # Affix + * 将页面元素钉在可视范围。 + * ## 何时使用 + * 当内容区域比较长,需要滚动页面时,这部分内容对应的操作或者导航需要在滚动范围内始终展现。常用于侧边菜单和按钮组合。 + * 页面可视范围过小时,慎用此功能以免遮挡页面内容。 + */ export class Affix extends React.Component{ } // Alert interface AlertProps extends React.Props { + /** + * 必选参数,指定警告提示的样式,有四种选择`success`、`info`、`warn`、`error` + */ type: string, + /**可选参数,默认不显示关闭按钮 */ closable?: boolean, + /**可选参数,自定义关闭按钮 */ closeText?: React.ReactNode, + /**必选参数,警告提示内容 */ message: React.ReactNode, + /**可选参数,警告提示的辅助性文字介绍 */ description?: React.ReactNode, + /**可选参数,关闭时触发的回调函数 */ onClose?: Function, + /**可选参数,是否显示辅助图标 */ showIcon?: boolean } + + + /** + * # Alert + * 警告提示,展现需要关注的信息。 + + * ## 何时使用 + + * - 当某个页面需要向用户显示警告的信息时。 + * - 非浮层的静态展现形式,始终展现,不会自动消失,用户可以点击关闭。 + * */ export class Alert extends React.Component{ } // Badge + /** + * #Badge + * + * 图标右上角的圆形徽标数字。 + + * ## 何时使用 + + * 一般出现在通知图标或头像的右上角,用于显示需要处理的消息条数,通过醒目视觉形式吸引用户处理。 + * + */ export class Badge extends React.Component{ } interface BadgeProps extends React.Props { + /** 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏*/ count: number, + /** 展示封顶的数字值*/ overflowCount?: number, + /** 不展示数字,只有一个小红点*/ dot?: boolean } // Button interface ButtonProps extends React.Props