-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
More strict plugin type definitions #205232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ML changes LGTM
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kibana-presentation changes LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Public APIs missing exports
History
cc @dgieselaar |
Starting backport for target branches: 8.x |
Stricter defaults for plugin types: `Plugin` and `CoreSetup` now have empty objects as defaults instead of `object` which is assignable to anything basically. This catches some type errors, but my motivation for this is to allow something like: ```ts function createPlugin ():Plugin<MySetupContract, MyStartContract, MySetupDependencies, MyStartDependencies> { return { // look ma, no additional typing necessary setup ( coreSetup, pluginsSetup ) { }, start ( coreStart, pluginsStart ) { } } } ``` (cherry picked from commit 98ce312)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.x`: - [More strict plugin type definitions (#205232)](#205232) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Dario Gieselaar","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-07T15:41:15Z","message":"More strict plugin type definitions (#205232)\n\nStricter defaults for plugin types: `Plugin` and `CoreSetup` now have\nempty objects as defaults instead of `object` which is assignable to\nanything basically. This catches some type errors, but my motivation for\nthis is to allow something like:\n\n```ts\nfunction createPlugin ():Plugin<MySetupContract, MyStartContract, MySetupDependencies, MyStartDependencies> {\n\treturn {\n\t\t// look ma, no additional typing necessary\n\t\tsetup ( coreSetup, pluginsSetup ) {\n\t\t},\n\t\tstart ( coreStart, pluginsStart ) {\n\t\t}\n\t}\n}\n```","sha":"98ce312ba36cbb7e4fc4a5cf16acc841c2f1b21f","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:obs-ux-management","backport:version","v8.18.0"],"title":"More strict plugin type definitions","number":205232,"url":"https://github.com/elastic/kibana/pull/205232","mergeCommit":{"message":"More strict plugin type definitions (#205232)\n\nStricter defaults for plugin types: `Plugin` and `CoreSetup` now have\nempty objects as defaults instead of `object` which is assignable to\nanything basically. This catches some type errors, but my motivation for\nthis is to allow something like:\n\n```ts\nfunction createPlugin ():Plugin<MySetupContract, MyStartContract, MySetupDependencies, MyStartDependencies> {\n\treturn {\n\t\t// look ma, no additional typing necessary\n\t\tsetup ( coreSetup, pluginsSetup ) {\n\t\t},\n\t\tstart ( coreStart, pluginsStart ) {\n\t\t}\n\t}\n}\n```","sha":"98ce312ba36cbb7e4fc4a5cf16acc841c2f1b21f"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/205232","number":205232,"mergeCommit":{"message":"More strict plugin type definitions (#205232)\n\nStricter defaults for plugin types: `Plugin` and `CoreSetup` now have\nempty objects as defaults instead of `object` which is assignable to\nanything basically. This catches some type errors, but my motivation for\nthis is to allow something like:\n\n```ts\nfunction createPlugin ():Plugin<MySetupContract, MyStartContract, MySetupDependencies, MyStartDependencies> {\n\treturn {\n\t\t// look ma, no additional typing necessary\n\t\tsetup ( coreSetup, pluginsSetup ) {\n\t\t},\n\t\tstart ( coreStart, pluginsStart ) {\n\t\t}\n\t}\n}\n```","sha":"98ce312ba36cbb7e4fc4a5cf16acc841c2f1b21f"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Dario Gieselaar <[email protected]>
Stricter defaults for plugin types: `Plugin` and `CoreSetup` now have empty objects as defaults instead of `object` which is assignable to anything basically. This catches some type errors, but my motivation for this is to allow something like: ```ts function createPlugin ():Plugin<MySetupContract, MyStartContract, MySetupDependencies, MyStartDependencies> { return { // look ma, no additional typing necessary setup ( coreSetup, pluginsSetup ) { }, start ( coreStart, pluginsStart ) { } } } ```
Stricter defaults for plugin types: `Plugin` and `CoreSetup` now have empty objects as defaults instead of `object` which is assignable to anything basically. This catches some type errors, but my motivation for this is to allow something like: ```ts function createPlugin ():Plugin<MySetupContract, MyStartContract, MySetupDependencies, MyStartDependencies> { return { // look ma, no additional typing necessary setup ( coreSetup, pluginsSetup ) { }, start ( coreStart, pluginsStart ) { } } } ```
Stricter defaults for plugin types: `Plugin` and `CoreSetup` now have empty objects as defaults instead of `object` which is assignable to anything basically. This catches some type errors, but my motivation for this is to allow something like: ```ts function createPlugin ():Plugin<MySetupContract, MyStartContract, MySetupDependencies, MyStartDependencies> { return { // look ma, no additional typing necessary setup ( coreSetup, pluginsSetup ) { }, start ( coreStart, pluginsStart ) { } } } ```
Stricter defaults for plugin types:
Plugin
andCoreSetup
now have empty objects as defaults instead ofobject
which is assignable to anything basically. This catches some type errors, but my motivation for this is to allow something like: