diff --git a/types/sharepoint/index.d.ts b/types/sharepoint/index.d.ts index 4852d8440c..b05d498648 100644 --- a/types/sharepoint/index.d.ts +++ b/types/sharepoint/index.d.ts @@ -6,7 +6,7 @@ // Tero Arvola // Dennis George // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.5 /// @@ -106,34 +106,29 @@ declare namespace SP { static resizeImageToSquareLength(imgElement: HTMLImageElement, squareLength: number): void; } - interface PageContextInfo { - new(): PageContextInfoInstance; - get_siteServerRelativeUrl(): string; - get_webServerRelativeUrl(): string; - get_webAbsoluteUrl(): string; - get_serverRequestPath(): string; - get_siteAbsoluteUrl(): string; - get_webTitle(): string; - get_tenantAppVersion(): string; - get_isAppWeb(): boolean; - get_webLogoUrl(): string; - get_webLanguage(): number; - get_currentLanguage(): number; - get_pageItemId(): number; - get_pageListId(): string; - get_webPermMasks(): { High: number; Low: number; }; - get_currentCultureName(): string; - get_currentUICultureName(): string; - get_clientServerTimeDelta(): number; - get_userLoginName(): string; - get_webTemplate(): string; + class PageContextInfo { + constructor(); + static get_siteServerRelativeUrl(): string; + static get_webServerRelativeUrl(): string; + static get_webAbsoluteUrl(): string; + static get_serverRequestPath(): string; + static get_siteAbsoluteUrl(): string; + static get_webTitle(): string; + static get_tenantAppVersion(): string; + static get_isAppWeb(): boolean; + static get_webLogoUrl(): string; + static get_webLanguage(): number; + static get_currentLanguage(): number; + static get_pageItemId(): number; + static get_pageListId(): string; + static get_webPermMasks(): { High: number; Low: number; }; + static get_currentCultureName(): string; + static get_currentUICultureName(): string; + static get_clientServerTimeDelta(): number; + static get_userLoginName(): string; + static get_webTemplate(): string; + static get_pagePersonalizationScope(): string; } - - interface PageContextInfoInstance { - get_pagePersonalizationScope(): string; - } - let PageContextInfo: PageContextInfo; - class ContextPermissions { has(perm: number): boolean; hasPermissions(high: number, low: number): boolean; @@ -2139,7 +2134,8 @@ declare namespace SP { constructor(); } /** Provides a base class for a collection of objects on a remote client. */ - interface ClientObjectCollection extends SP.ClientObject, IEnumerable { + class ClientObjectCollection extends SP.ClientObject implements IEnumerable { + constructor(); get_areItemsAvailable(): boolean; /** Gets the data for all of the items in the collection. */ retrieveItems(): SP.ClientObjectPrototype; @@ -2152,20 +2148,11 @@ declare namespace SP { getItemAtIndex(index: number): T; fromJson(obj: any): void; } - interface ClientObjectCollectionConstructor { - new(): ClientObjectCollection; - } - let ClientObjectCollection: ClientObjectCollectionConstructor; - - interface ClientObjectList extends SP.ClientObjectCollection { - new(context: SP.ClientRuntimeContext, objectPath: SP.ObjectPath, childItemType: any); + class ClientObjectList extends SP.ClientObjectCollection { + constructor(context: SP.ClientRuntimeContext, objectPath: SP.ObjectPath, childItemType: any); fromJson(initValue: any): void; customFromJson(initValue: any): boolean; } - interface ClientObjectListConstructor { - new(context: SP.ClientRuntimeContext, objectPath: SP.ObjectPath, childItemType: any): ClientObjectList; - } - let ClientObjectList: ClientObjectListConstructor; class ClientObjectPrototype { retrieve(propertyNames?: string[]): void; retrieveObject(propertyName: string): SP.ClientObjectPrototype; @@ -2209,8 +2196,8 @@ declare namespace SP { } class ClientRequestSucceededEventArgs extends SP.ClientRequestEventArgs { } - interface ClientRuntimeContext extends Sys.IDisposable { - new(serverRelativeUrlOrFullUrl: string); + class ClientRuntimeContext implements Sys.IDisposable { + constructor(serverRelativeUrlOrFullUrl: string); get_url(): string; get_viaUrl(): string; set_viaUrl(value: string): void; @@ -2447,16 +2434,13 @@ declare namespace SP { assemblyVersion: string; wssMajorVersion: string; } - interface ClientContext extends SP.ClientRuntimeContext { + class ClientContext extends SP.ClientRuntimeContext { + constructor(serverRelativeUrlOrFullUrl?: string); get_web(): SP.Web; get_site(): SP.Site; get_serverVersion(): string; + static get_current(): SP.ClientContext; } - interface ClientContextConstructor { - new(serverRelativeUrlOrFullUrl?: string): ClientContext; - get_current(): SP.ClientContext; - } - let ClientContext: ClientContextConstructor; enum ULSTraceLevel { verbose, } @@ -4402,18 +4386,15 @@ declare namespace SP { update(): void; deleteObject(): void; } - interface RoleDefinitionBindingCollectionConstructor { - new(context: SP.ClientRuntimeContext): SP.RoleDefinitionBindingCollection; - newObject(context: SP.ClientRuntimeContext): SP.RoleDefinitionBindingCollection; - } - interface RoleDefinitionBindingCollection extends SP.ClientObjectCollection { + class RoleDefinitionBindingCollection extends SP.ClientObjectCollection { + constructor(context: SP.ClientRuntimeContext); itemAt(index: number): SP.RoleDefinition; get_item(index: number): SP.RoleDefinition; add(roleDefinition: SP.RoleDefinition): void; remove(roleDefinition: SP.RoleDefinition): void; removeAll(): void; + static newObject(context: SP.ClientRuntimeContext): SP.RoleDefinitionBindingCollection; } - let RoleDefinitionBindingCollection: RoleDefinitionBindingCollectionConstructor; interface RoleDefinitionCollection extends SP.ClientObjectCollection { itemAt(index: number): SP.RoleDefinition; get_item(index: number): SP.RoleDefinition; @@ -5308,17 +5289,14 @@ declare namespace Microsoft.SharePoint.Client.Search { exportPopularQueries: (web: SP.Web, sourceId: SP.Guid) => SP.JsonObjectResult; } - interface StringCollection extends SP.ClientObjectCollection { - itemAt: (index: number) => string; - get_item: (index: number) => string; - get_childItemType: () => typeof String; - add: (property: string) => void; - clear: () => void; + class StringCollection extends SP.ClientObjectCollection { + constructor(context: SP.ClientContext); + itemAt(index: number): string; + get_item(index: number): string; + get_childItemType(): typeof String; + add(property: string): void; + clear(): void; } - interface StringCollectionConstructor { - new(context: SP.ClientContext): StringCollection; - } - let StringCollection: StringCollectionConstructor; class QueryPersonalizationData extends SP.ClientObject { // It's really empty; @@ -5393,11 +5371,11 @@ declare namespace Microsoft.SharePoint.Client.Search { static queryPropertyValueToObject: (val: QueryPropertyValue) => any; } interface ReorderingRuleCollection extends SP.ClientObjectCollection { - itemAt: (index: number) => ReorderingRule; - get_item: (index: number) => ReorderingRule; - get_childItemType: () => typeof ReorderingRule; - add: (property: ReorderingRule) => void; - clear: () => void; + itemAt(index: number): ReorderingRule; + get_item(index: number): ReorderingRule; + get_childItemType(): typeof ReorderingRule; + add(property: ReorderingRule): void; + clear(): void; } enum ReorderingRuleMatchType { @@ -5424,11 +5402,11 @@ declare namespace Microsoft.SharePoint.Client.Search { } interface SortCollection extends SP.ClientObjectCollection { - itemAt: (index: number) => Sort; - get_item: (index: number) => Sort; - get_childItemType: () => typeof Sort; - add: (strProperty: string, sortDirection: SortDirection) => void; - clear: () => void; + itemAt(index: number): Sort; + get_item(index: number): Sort; + get_childItemType(): typeof Sort; + add(strProperty: string, sortDirection: SortDirection): void; + clear(): void; } enum SortDirection { @@ -6928,15 +6906,12 @@ declare namespace SP { getValidatedString(value: TaxonomyFieldValue): SP.StringResult; } - interface TaxonomyFieldValueCollection extends SP.ClientObjectCollection { + class TaxonomyFieldValueCollection extends SP.ClientObjectCollection { + constructor(context: SP.ClientContext, fieldValue: string, creatingField: SP.Field); itemAt(index: number): TaxonomyFieldValue; get_item(index: number): TaxonomyFieldValue; populateFromLabelGuidPairs(text: string): void; } - interface TaxonomyFieldValueCollectionConstructor { - new(context: SP.ClientContext, fieldValue: string, creatingField: SP.Field): TaxonomyFieldValueCollection; - } - let TaxonomyFieldValueCollection: TaxonomyFieldValueCollectionConstructor; class TaxonomyFieldValue extends SP.ClientValueObject { get_label(): string; diff --git a/types/sharepoint/tslint.json b/types/sharepoint/tslint.json index c1514ba316..06bd920191 100644 --- a/types/sharepoint/tslint.json +++ b/types/sharepoint/tslint.json @@ -8,6 +8,7 @@ "no-any-union": false, "no-const-enum": false, "no-duplicate-imports": false, + "no-empty-interface": false, "no-inferrable-types": false, "no-namespace": false, "no-mergeable-namespace": false,