index.d.ts
89 lines
| 3.0 KiB
| video/mp2t
|
TypeScriptLexer
cin
|
r109 | // eslint-disable-next-line @typescript-eslint/triple-slash-reference | |
cin
|
r97 | /// <reference path="./css-plugin.d.ts"/> | |
cin
|
r65 | ||
cin
|
r129 | import _WidgetBase = require("dijit/_WidgetBase"); | |
cin
|
r109 | import { Rendition } from "./tsx/traits"; | |
cin
|
r96 | ||
cin
|
r109 | declare global { | |
namespace JSX { | |||
type Ref<T> = ((value: T | undefined) => void); | |||
cin
|
r129 | type Element = Rendition | _WidgetBase; | |
cin
|
r65 | ||
cin
|
r109 | interface DjxIntrinsicAttributes<E> { | |
/** alias for className */ | |||
class?: string; | |||
cin
|
r65 | ||
cin
|
r109 | /** specifies the name of the property in the widget where the the | |
* reference to the current object will be stored | |||
*/ | |||
"data-dojo-attach-point"?: string; | |||
cin
|
r65 | ||
cin
|
r109 | /** specifies handlers map for the events */ | |
"data-dojo-attach-event"?: string; | |||
cin
|
r96 | ||
cin
|
r109 | ref?: Ref<E>; | |
cin
|
r65 | ||
cin
|
r109 | /** @deprecated */ | |
[attr: string]: unknown; | |||
} | |||
cin
|
r65 | ||
cin
|
r109 | // eslint-disable-next-line @typescript-eslint/no-empty-interface | |
interface DjxIntrinsicElements { | |||
} | |||
type RecursivePartial<T> = T extends string | number | boolean | null | undefined | ((...args: unknown[]) => unknown) ? | |||
T : | |||
{ [k in keyof T]?: RecursivePartial<T[k]> }; | |||
cin
|
r65 | ||
cin
|
r109 | type MatchingMemberKeys<T, U> = { | |
[K in keyof T]: T[K] extends U ? K : never; | |||
}[keyof T]; | |||
type NotMatchingMemberKeys<T, U> = { | |||
[K in keyof T]: T[K] extends U ? never : K; | |||
}[keyof T]; | |||
cin
|
r65 | ||
cin
|
r109 | type ExtractMembers<T, U> = Pick<T, MatchingMemberKeys<T, U>>; | |
cin
|
r65 | ||
cin
|
r109 | type ExcludeMembers<T, U> = Pick<T, NotMatchingMemberKeys<T, U>>; | |
cin
|
r65 | ||
cin
|
r109 | type ElementAttrNames<E> = NotMatchingMemberKeys<E, (...args: unknown[]) => unknown>; | |
cin
|
r65 | ||
cin
|
r109 | type ElementAttrType<E, K extends string | symbol> = K extends keyof E ? RecursivePartial<E[K]> : string; | |
cin
|
r65 | ||
cin
|
r109 | type ElementAttrNamesBlacklist = "children" | "getRootNode" | keyof EventTarget; | |
cin
|
r65 | ||
cin
|
r109 | /** This type extracts keys of the specified parameter E by the following rule: | |
* 1. skips all ElementAttrNamesBlacklist | |||
* 2. skips all methods except with the signature of event handlers | |||
*/ | |||
type AssignableElementAttrNames<E> = { | |||
[K in keyof E]: K extends ElementAttrNamesBlacklist ? never : | |||
((evt: Event) => unknown) extends E[K] ? K : | |||
E[K] extends ((...args: unknown[]) => unknown) ? never : | |||
cin
|
r65 | K; | |
cin
|
r109 | }[keyof E]; | |
cin
|
r65 | ||
cin
|
r109 | type LaxElement<E extends object> = | |
RecursivePartial<Pick<E, AssignableElementAttrNames<E>>> & | |||
DjxIntrinsicAttributes<E>; | |||
cin
|
r65 | ||
cin
|
r109 | type LaxIntrinsicElementsMap = { | |
[tag in keyof HTMLElementTagNameMap]: LaxElement<HTMLElementTagNameMap[tag]> | |||
} & DjxIntrinsicElements; | |||
cin
|
r65 | ||
cin
|
r109 | type IntrinsicElements = { | |
[tag in keyof LaxIntrinsicElementsMap]: LaxIntrinsicElementsMap[tag]; | |||
}; | |||
cin
|
r96 | ||
cin
|
r109 | interface ElementChildrenAttribute { | |
children: unknown; | |||
} | |||
cin
|
r96 | ||
cin
|
r109 | interface IntrinsicClassAttributes<T> { | |
ref?: Ref<T>; | |||
children?: unknown; | |||
} | |||
cin
|
r96 | } | |
cin
|
r109 | } |