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

Add all typescript types for web-js #68

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"lint:js": "eslint packages",
"lint:js:fix": "eslint packages --fix",
"lint:css": "stylelint packages/scss/**/*.scss",
"lint:css:fix": "stylelint packages/scss/**/*.scss --fix"
"lint:css:fix": "stylelint packages/scss/**/*.scss --fix",
"ts:type:generation": "npx tsc"
},
"keywords": [
"js",
Expand All @@ -31,6 +32,7 @@
"eslint": "^4.19.1",
"eslint-config-ma": "^1.0.1",
"stylelint": "^9.2.1",
"stylelint-config-ma": "^1.1.1"
"stylelint-config-ma": "^1.1.1",
"typescript": "^4.5.5"
}
}
10 changes: 10 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"include": ["packages/**/*"],
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "types",
"declarationMap": true
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{
"include": ["packages/**/*"],
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "types",
"declarationMap": true
}
}
{
"include": ["packages/**/*"],
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "types",
"declarationMap": true
}
}

5 changes: 5 additions & 0 deletions types/components/accordion/accordion.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare function _exports(): {
initialize: (el: HTMLElement, options: object) => void;
};
export = _exports;
//# sourceMappingURL=accordion.d.ts.map
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the map files?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexander-schranz if you want to provide autocomplitons for IDE yes, if not it can be disabled with "declarationMap": false

1 change: 1 addition & 0 deletions types/components/accordion/accordion.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions types/components/container-link/container-link.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare function _exports(): {
initialize: (el: HTMLElement) => void;
};
export = _exports;
//# sourceMappingURL=container-link.d.ts.map
1 change: 1 addition & 0 deletions types/components/container-link/container-link.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions types/components/expand/expand.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare function _exports(): {
initialize: (el: HTMLElement, options: object) => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we can provide a interface for this? So we don't need declare this over again?

};
export = _exports;
//# sourceMappingURL=expand.d.ts.map
1 change: 1 addition & 0 deletions types/components/expand/expand.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions types/components/scroll-direction/scroll-direction.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare function _exports(): {
initialize: (el: HTMLElement, options: object) => void;
};
export = _exports;
//# sourceMappingURL=scroll-direction.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions types/components/scroll-menu/scroll-menu.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare function _exports(): {
initialize: (el: HTMLElement, options: object) => void;
};
export = _exports;
//# sourceMappingURL=scroll-menu.d.ts.map
1 change: 1 addition & 0 deletions types/components/scroll-menu/scroll-menu.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions types/components/tabs/tabs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare function _exports(): {
initialize: (el: HTMLElement) => void;
};
export = _exports;
//# sourceMappingURL=tabs.d.ts.map
1 change: 1 addition & 0 deletions types/components/tabs/tabs.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions types/components/toggle/toggle.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare function _exports(): {
initialize: (el: HTMLElement, options: object) => void;
};
export = _exports;
//# sourceMappingURL=toggle.d.ts.map
1 change: 1 addition & 0 deletions types/components/toggle/toggle.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions types/components/truncate/truncate.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare function _exports(): {
initialize: (el: HTMLElement, options: object) => void;
};
export = _exports;
//# sourceMappingURL=truncate.d.ts.map
1 change: 1 addition & 0 deletions types/components/truncate/truncate.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions types/components/window-scroll/window-scroll.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare function _exports(): {
initialize: (el: HTMLElement, options: object) => void;
};
export = _exports;
//# sourceMappingURL=window-scroll.d.ts.map
1 change: 1 addition & 0 deletions types/components/window-scroll/window-scroll.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions types/core/core.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
declare namespace web { }
import registerComponent = web.registerComponent;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does typescript correctly read the types from jsdocs here?

* @param {String} name
* @param {Object} component
* @param {Object} defaultOptions

So it will correctly fail if it is called with something else?

import registerService = web.registerService;
import startComponents = web.startComponents;
import callServices = web.callServices;
import startComponent = web.startComponent;
import callService = web.callService;
import getService = web.getService;
import getComponent = web.getComponent;
import hasComponent = web.hasComponent;
import hasService = web.hasService;
import removeComponent = web.removeComponent;
export { registerComponent, registerService, startComponents, callServices, startComponent, callService, getService, getComponent, hasComponent, hasService, removeComponent };
//# sourceMappingURL=core.d.ts.map
1 change: 1 addition & 0 deletions types/core/core.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions types/experimental/lazy/lazy.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const registerComponent: any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks weird?

Why looks this different then the core.js?

Copy link
Author

@mario-fehr mario-fehr May 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of this declaration:

var lazy = {
       componentRegistry: {},
       serviceRegistry: {},
       deferredComponents: {},
       deferredServices: {},
   };

export const registerService: any;
export const startComponents: any;
export const startServices: any;
//# sourceMappingURL=lazy.d.ts.map
1 change: 1 addition & 0 deletions types/experimental/lazy/lazy.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions types/services/api/api.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export declare function get(uri: any, data: any): Promise<any>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uri: any looks false, same for data: any

export declare function post(uri: any, data: any): Promise<any>;
export declare function put(uri: any, data: any): Promise<any>;
declare function _delete(uri: any, data: any): Promise<any>;
export { _delete as delete };
//# sourceMappingURL=api.d.ts.map
1 change: 1 addition & 0 deletions types/services/api/api.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions types/services/debounce/debounce.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare function _exports(func: any, wait: any, immediate: any): (...args: any[]) => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsdocs should be defined correctly so it will also get func: any, wait: int correctly:

* Extracted from UnderscoreJS
*
* @ignore

export = _exports;
//# sourceMappingURL=debounce.d.ts.map
1 change: 1 addition & 0 deletions types/services/debounce/debounce.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions types/services/google-map-library/google-map-library.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const key: string;
export const promise: any;
Comment on lines +1 to +2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me looks here are all methods missing.

//# sourceMappingURL=google-map-library.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions types/services/passive-events/passive-events.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export = supportsPassive;
declare var supportsPassive: boolean;
//# sourceMappingURL=passive-events.d.ts.map
1 change: 1 addition & 0 deletions types/services/passive-events/passive-events.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.