# HG changeset patch # User cin # Date 2020-10-20 16:39:50 # Node ID ac3004768754485f6c2a344ec233709375abc929 # Parent b8741599097eeba67c485f7ca237980a50052ad4 Working on IntrisictElements to support legacy and new tsx styles diff --git a/.vscode/settings.json b/.vscode/settings.json --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,6 +7,7 @@ "**/.factorypath": true }, "cSpell.words": [ + "dijit", "djbase", "djclass" ] diff --git a/build.gradle b/build.gradle --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ configureTsMain { configureTsTest { compilerOptions { typeRoots = [] - types = ["requirejs", sources.main.output.typingsDir.get().toString() ] + types = ["requirejs", sources.main.output.typingsDir.get().toString()+"/legacy" ] } } diff --git a/package-lock.json b/package-lock.json --- a/package-lock.json +++ b/package-lock.json @@ -34,9 +34,9 @@ } }, "@implab/core-amd": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@implab/core-amd/-/core-amd-1.3.2.tgz", - "integrity": "sha512-OPx02obqz60FiOzDqEFuPfag/0ugl1tuQouI+52Op0k+fcmuBK4QACJy7o3fzOYvejdjF1DG4aRXuCm6+vgMYQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@implab/core-amd/-/core-amd-1.4.0.tgz", + "integrity": "sha512-gaJX1mhri7YpmXDTAYELZnmTznzXYpk2AI7Decsttdi6xY+bqGgH24q0AFcKrx8RY2jfsFXxDdf0fITz2HpBbw==", "dev": true }, "@types/chai": { diff --git a/package.json b/package.json --- a/package.json +++ b/package.json @@ -16,10 +16,10 @@ }, "peerDependencies": { "dojo": "1.16.0", - "@implab/core-amd": "^1.3.2" + "@implab/core-amd": "^1.4.0" }, "devDependencies": { - "@implab/core-amd": "^1.3.2", + "@implab/core-amd": "^1.4.0", "@types/chai": "4.1.3", "@types/requirejs": "2.1.31", "@types/yaml": "1.2.0", diff --git a/src/main/ts/tsx/BuildContextBase.ts b/src/main/ts/tsx/BuildContextBase.ts --- a/src/main/ts/tsx/BuildContextBase.ts +++ b/src/main/ts/tsx/BuildContextBase.ts @@ -15,7 +15,8 @@ export abstract class BuildContextBase{value}} ) return; if (isPlainObject(v)) { @@ -29,7 +30,7 @@ export abstract class BuildContextBase(key: K, value: this[K]): void; + } + + interface TooltipDialog { + + content: any; + + } +} diff --git a/src/main/typings/index.d.ts b/src/main/typings/index.d.ts --- a/src/main/typings/index.d.ts +++ b/src/main/typings/index.d.ts @@ -1,30 +1,34 @@ -declare module "@implab/djx/css!*" { - const result: { url: string }; - export = result; -} +/// +/// declare namespace JSX { + interface DjxIntrinsicAttributes { class: string; "data-dojo-attach-point": string; "data-dojo-attach-event": string; } - type IntrinsicElements = { - [name in keyof HTMLElementTagNameMap]: Partial & DjxIntrinsicAttributes>; + + type RecursivePartial = T extends string | number | boolean | null | undefined | Function ? + T : + { [k in keyof T]?: RecursivePartial }; + + type MatchingMemberKeys = { + [K in keyof T]: T[K] extends U ? K : never; + }[keyof T]; + type NotMatchingMemberKeys = { + [K in keyof T]: T[K] extends U ? never : K; + }[keyof T]; + type ElementAttrNames = NotMatchingMemberKeys any>; + + type ElementAttrType = K extends keyof E ? RecursivePartial : string; + + type LaxElement = E & { } + + type LegacyElementAttributes = { + [attr in ElementAttrNames]?: ElementAttrType; + } | Partial; + interface IntrinsicElements { + [tag: keyof HTMLElementTagNameMap]: LegacyElementAttributes; } } - -declare namespace dijit { - interface _WidgetBase { - - _started?: boolean; - - _set(key: K, value: this[K]): void; - } - - interface TooltipDialog { - - content: any; - - } -} \ No newline at end of file diff --git a/src/main/typings/legacy.d.ts b/src/main/typings/legacy.d.ts new file mode 100644 --- /dev/null +++ b/src/main/typings/legacy.d.ts @@ -0,0 +1,7 @@ +/// + +declare namespace JSX { + interface IntrinsicElements { + + } +} \ No newline at end of file diff --git a/src/test/ts/view/MyWidget.tsx b/src/test/ts/view/MyWidget.tsx --- a/src/test/ts/view/MyWidget.tsx +++ b/src/test/ts/view/MyWidget.tsx @@ -27,12 +27,17 @@ export class MyWidget extends djbase(Djx render() { const Frame = (props: any) =>
{props.children}
; - return
+ return

this._onIncClick(e)}>[+] - this._onDecClick()}>[-] + this._onDecClick()}>[-] + + + + +
; } diff --git a/src/test/tsconfig.json b/src/test/tsconfig.json --- a/src/test/tsconfig.json +++ b/src/test/tsconfig.json @@ -8,6 +8,6 @@ "../main/ts", "../main/typings" ], - "types": ["requirejs", "../main/typings", "dojo-typings"] + "types": ["requirejs", "../main/typings/legacy", "dojo-typings"] } } \ No newline at end of file diff --git a/src/tsconfig.json b/src/tsconfig.json --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -6,7 +6,7 @@ "types": [], "experimentalDecorators": true, "jsxFactory": "createElement", - "skipLibCheck": true, + //"skipLibCheck": true, "jsx": "react", "lib": ["es5", "es2015.promise", "es2015.symbol", "es2015.iterable", "dom", "scripthost"] }