Skip to content
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

[WIP] TS Decalrations #947

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@
"exports": {
"./processors/*": "./lib/processors/*.js",
"./processors/jsdoc/lib/*": null,
"./tasks/*": "./lib/tasks/*.js",
"./tasks/*": {
"default": "./lib/tasks/*.js",
"types": "./types/*.d.ts"
},
"./tasks/taskRepository": null,
"./tasks/bundlers/utils/*": null,
"./package.json": "./package.json",
"./internal/taskRepository": "./lib/tasks/taskRepository.js",
"./internal/jsdoc/template/publish": "./lib/processors/jsdoc/lib/ui5/template/publish.cjs"
"./internal/jsdoc/template/publish": "./lib/processors/jsdoc/lib/ui5/template/publish.cjs",
"./types": "./types/index.d.ts"
},
"engines": {
"node": "^16.18.0 || >=18.12.0",
Expand Down
11 changes: 11 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "esnext",
"noEmit": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"allowSyntheticDefaultImports": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
},
}
25 changes: 25 additions & 0 deletions types/TaskParameters.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// declare module "@ui5/builder/task/TaskParameters" {
import type { TaskUtil } from "@ui5/project/build/helpers/TaskUtil";

// Mock some of the types, so it would be easier to follow
declare type ui5_fs_DuplexCollection = object

// This one should be (eventually) provided globally or as a part of @ui5/project/Specification
declare type availableSpecVersions = "2.0" | "2.2" | "3.0" | "3.2";

declare interface TaskParametersBase {
workspace: ui5_fs_DuplexCollection,
options: {
omitSourceMapResources?: boolean,
useInputSourceMaps?: boolean,
}
}

declare interface TaskParameters_2_2<specVersion extends availableSpecVersions> extends TaskParametersBase {
taskUtil: TaskUtil<specVersion>
}

export declare type TaskParameters<specVersion extends availableSpecVersions> = specVersion extends "2.2" | "3.0" | "3.2"
? TaskParameters_2_2<specVersion>
: TaskParametersBase
// }
Loading