-
Notifications
You must be signed in to change notification settings - Fork 35
feat(ts-interface-generator): bundle TypeScript as direct dependency, allow usage in TS7 projects #659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
akudev
wants to merge
1
commit into
main
Choose a base branch
from
chore/ts7
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+457
−16
Open
feat(ts-interface-generator): bundle TypeScript as direct dependency, allow usage in TS7 projects #659
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@ui5/ts-interface-generator": minor | ||
| --- | ||
|
|
||
| The `typescript` peer dependency has been removed. The tool now bundles its own TypeScript compiler internally (pinned to TypeScript 6.0.3), so it works regardless of which TypeScript version your project uses — including TypeScript 7. | ||
|
|
||
| Also fixes path resolution for projects that use `paths` without `baseUrl` and suppresses spurious diagnostics for unrecognized compiler options. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...ges/ts-interface-generator/src/test/testcases/tsconfig-path-no-baseurl/MyControl.gen.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import { MyJSEnum } from "my/library"; | ||
| import { MyTSEnum } from "my/library"; | ||
| import MyDependency from "my/MyDependency"; | ||
| import { PropertyBindingInfo } from "sap/ui/base/ManagedObject"; | ||
| import { $ControlSettings } from "sap/ui/core/Control"; | ||
|
|
||
| declare module "./MyControl" { | ||
|
|
||
| /** | ||
| * Interface defining the settings object used in constructor calls | ||
| */ | ||
| interface $MyControlSettings extends $ControlSettings { | ||
| myJSEnumVal?: MyJSEnum | PropertyBindingInfo | `{${string}}`; | ||
| myTSEnumVal?: MyTSEnum | PropertyBindingInfo | `{${string}}`; | ||
| myDependency?: MyDependency | PropertyBindingInfo | `{${string}}`; | ||
| } | ||
|
|
||
| export default interface MyControl { | ||
|
|
||
| // property: myJSEnumVal | ||
|
|
||
| /** | ||
| * Gets current value of property "myJSEnumVal". | ||
| * | ||
| * Default value is: "MyJSEnum.Foo," | ||
| * @returns Value of property "myJSEnumVal" | ||
| */ | ||
| getMyJSEnumVal(): MyJSEnum; | ||
|
|
||
| /** | ||
| * Sets a new value for property "myJSEnumVal". | ||
| * | ||
| * When called with a value of "null" or "undefined", the default value of the property will be restored. | ||
| * | ||
| * Default value is: "MyJSEnum.Foo," | ||
| * @param [myJSEnumVal="MyJSEnum.Foo,"] New value for property "myJSEnumVal" | ||
| * @returns Reference to "this" in order to allow method chaining | ||
| */ | ||
| setMyJSEnumVal(myJSEnumVal: MyJSEnum): this; | ||
|
|
||
| // property: myTSEnumVal | ||
|
|
||
| /** | ||
| * Gets current value of property "myTSEnumVal". | ||
| * | ||
| * Default value is: "MyTSEnum.Foo," | ||
| * @returns Value of property "myTSEnumVal" | ||
| */ | ||
| getMyTSEnumVal(): MyTSEnum; | ||
|
|
||
| /** | ||
| * Sets a new value for property "myTSEnumVal". | ||
| * | ||
| * When called with a value of "null" or "undefined", the default value of the property will be restored. | ||
| * | ||
| * Default value is: "MyTSEnum.Foo," | ||
| * @param [myTSEnumVal="MyTSEnum.Foo,"] New value for property "myTSEnumVal" | ||
| * @returns Reference to "this" in order to allow method chaining | ||
| */ | ||
| setMyTSEnumVal(myTSEnumVal: MyTSEnum): this; | ||
|
|
||
| // property: myDependency | ||
|
|
||
| /** | ||
| * Gets current value of property "myDependency". | ||
| * | ||
| * @returns Value of property "myDependency" | ||
| */ | ||
| getMyDependency(): MyDependency; | ||
|
|
||
| /** | ||
| * Sets a new value for property "myDependency". | ||
| * | ||
| * When called with a value of "null" or "undefined", the default value of the property will be restored. | ||
| * | ||
| * @param myDependency New value for property "myDependency" | ||
| * @returns Reference to "this" in order to allow method chaining | ||
| */ | ||
| setMyDependency(myDependency: MyDependency): this; | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
packages/ts-interface-generator/src/test/testcases/tsconfig-path-no-baseurl/MyControl.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import Control from "sap/ui/core/Control"; | ||
| import type { MetadataOptions } from "sap/ui/core/Element"; | ||
| import { MyJSEnum, MyTSEnum } from "./library"; | ||
|
|
||
| export default class MyControl extends Control { | ||
| static readonly metadata: MetadataOptions = { | ||
| properties: { | ||
| myJSEnumVal: { | ||
| type: "my.MyJSEnum", | ||
| defaultValue: MyJSEnum.Foo, | ||
| }, | ||
| myTSEnumVal: { | ||
| type: "my.MyTSEnum", | ||
| defaultValue: MyTSEnum.Foo, | ||
| }, | ||
| myDependency: { | ||
| type: "my.MyDependency", | ||
| }, | ||
| }, | ||
| }; | ||
| constructor(idOrSettings?: string | $MyControlSettings); | ||
| constructor(id?: string, settings?: $MyControlSettings); | ||
| constructor(id?: string, settings?: $MyControlSettings) { super(id, settings); } | ||
| } |
36 changes: 36 additions & 0 deletions
36
.../ts-interface-generator/src/test/testcases/tsconfig-path-no-baseurl/MyDependency.gen.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { PropertyBindingInfo } from "sap/ui/base/ManagedObject"; | ||
| import { $ControlSettings } from "sap/ui/core/Control"; | ||
|
|
||
| declare module "./MyDependency" { | ||
|
|
||
| /** | ||
| * Interface defining the settings object used in constructor calls | ||
| */ | ||
| interface $MyDependencySettings extends $ControlSettings { | ||
| foo?: string | PropertyBindingInfo; | ||
| } | ||
|
|
||
| export default interface MyDependency { | ||
|
|
||
| // property: foo | ||
|
|
||
| /** | ||
| * Gets current value of property "foo". | ||
| * | ||
| * Default value is: "bar" | ||
| * @returns Value of property "foo" | ||
| */ | ||
| getFoo(): string; | ||
|
|
||
| /** | ||
| * Sets a new value for property "foo". | ||
| * | ||
| * When called with a value of "null" or "undefined", the default value of the property will be restored. | ||
| * | ||
| * Default value is: "bar" | ||
| * @param [foo="bar"] New value for property "foo" | ||
| * @returns Reference to "this" in order to allow method chaining | ||
| */ | ||
| setFoo(foo: string): this; | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
packages/ts-interface-generator/src/test/testcases/tsconfig-path-no-baseurl/MyDependency.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import Control from "sap/ui/core/Control"; | ||
| import type { MetadataOptions } from "sap/ui/core/Element"; | ||
|
|
||
| export default class MyDependency extends Control { | ||
| static readonly metadata: MetadataOptions = { | ||
| properties: { | ||
| foo: { | ||
| type: "string", | ||
| defaultValue: "bar", | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| constructor(idOrSettings?: string | $MyDependencySettings); | ||
| constructor(id?: string, settings?: $MyDependencySettings); | ||
| constructor(id?: string, settings?: $MyDependencySettings) { super(id, settings); } | ||
| } |
29 changes: 29 additions & 0 deletions
29
packages/ts-interface-generator/src/test/testcases/tsconfig-path-no-baseurl/library.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import DataType from "sap/ui/base/DataType"; | ||
| import Lib from "sap/ui/core/Lib"; | ||
|
|
||
| const thisLib: object&{MyJSEnum?: object; MyTSEnum?: object} = Lib.init({ | ||
| name: "my", | ||
| version: "${version}", | ||
| dependencies: ["sap.ui.core"], | ||
| types: [], | ||
| interfaces: [], | ||
| controls: [], | ||
| elements: [], | ||
| noLibraryCSS: false, | ||
| }); | ||
|
|
||
| export const MyJSEnum = { | ||
| Foo: "foo", | ||
| Bar: "bar", | ||
| } as const; | ||
| thisLib.MyJSEnum = MyJSEnum; | ||
| DataType.registerEnum("mylib.MyJSEnum", thisLib.MyJSEnum); | ||
|
|
||
| export enum MyTSEnum { | ||
| Foo = "foo", | ||
| Bar = "bar", | ||
| } | ||
| thisLib.MyTSEnum = MyTSEnum; | ||
| DataType.registerEnum("mylib.MyTSEnum", thisLib.MyTSEnum); | ||
|
|
||
| export default thisLib; |
16 changes: 16 additions & 0 deletions
16
packages/ts-interface-generator/src/test/testcases/tsconfig-path-no-baseurl/tsconfig.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "target": "ES2022", | ||
| "module": "Node16", | ||
| "strict": true, | ||
| "moduleResolution": "Node16", | ||
| "esModuleInterop": true, | ||
| "skipLibCheck": true, | ||
| "forceConsistentCasingInFileNames": true, | ||
| "types": ["openui5"], | ||
| "noEmit": true, | ||
| "paths": { | ||
| "my/*": ["./*"] | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.