-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
Fix unsafe type assertions on object literals #211878
Comments
mjbvz
added a commit
to mjbvz/vscode
that referenced
this issue
May 2, 2024
mjbvz
added a commit
that referenced
this issue
May 2, 2024
alexr00
added a commit
that referenced
this issue
May 3, 2024
I think I got all mine ✅ |
alexr00
added a commit
that referenced
this issue
May 3, 2024
Merged
I got rid of mine, but I had to add a new cast via a |
connor4312
added a commit
that referenced
this issue
May 6, 2024
connor4312
added a commit
that referenced
this issue
May 6, 2024
rzhao271
added a commit
that referenced
this issue
May 6, 2024
rzhao271
added a commit
that referenced
this issue
May 7, 2024
meganrogge
added a commit
that referenced
this issue
May 7, 2024
mjbvz
added a commit
to mjbvz/vscode
that referenced
this issue
May 13, 2024
mjbvz
added a commit
that referenced
this issue
May 13, 2024
Merged
SimonSiefke
pushed a commit
to SimonSiefke/vscode
that referenced
this issue
May 14, 2024
SimonSiefke
pushed a commit
to SimonSiefke/vscode
that referenced
this issue
May 14, 2024
roblourens
added a commit
that referenced
this issue
Jul 30, 2024
roblourens
added a commit
that referenced
this issue
Jul 30, 2024
TylerLeonhardt
added a commit
that referenced
this issue
Aug 2, 2024
Merged
bpasero
added a commit
that referenced
this issue
Aug 3, 2024
bpasero
added a commit
that referenced
this issue
Aug 3, 2024
connor4312
added a commit
that referenced
this issue
Sep 6, 2024
connor4312
added a commit
that referenced
this issue
Sep 6, 2024
connor4312
added a commit
that referenced
this issue
Sep 6, 2024
Getting close! Thanks for all the help. Let's plan on finishing this up in the October debt week |
vs-code-engineering
bot
added
the
unreleased
Patch has not yet been released in VS Code Insiders
label
Sep 27, 2024
vs-code-engineering
bot
removed
the
unreleased
Patch has not yet been released in VS Code Insiders
label
Sep 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
<T>{ ... }
style type assertions are unsafe as they can hide some common typing errors such as missing properties on the object. This has caused errors for me multiple times now, so I think it would be good to make a pass through the codeFixing
I've added a new eslint rule for this called
local/code-no-dangerous-type-assertions
. You can turn it on in.eslintrc.json
In most cases, we should prefer using proper typings such as:
If you want to make sure an object fulfills a certain type, prefer using the
satisfies
operator instead which will enforce the type without actually changing its shape:Note that this rule still allows
<any>
casts for now. You can also suppress this rule in the few cases where you need to workaround it using an eslint commentTracking
src/vs/base/common/event.ts
src/vs/base/common/objects.ts
src/vs/base/common/uri.ts
@jriekensrc/vs/base/common/worker/simpleWorker.ts
src/vs/base/parts/ipc/common/ipc.ts
src/vs/base/parts/ipc/node/ipc.cp.ts
src/vs/editor/browser/services/webWorker.ts
src/vs/editor/browser/widget/diffEditor/utils.ts
src/vs/editor/contrib/hover/browser/markerHoverParticipant.ts
needs help from @bpaserosrc/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.ts
@TylerLeonhardtsrc/vs/nls.ts
@TylerLeonhardtsrc/vs/platform/environment/node/argv.ts
src/vs/platform/issue/electron-main/issueMainService.ts
@justschensrc/vs/platform/list/browser/listService.ts
src/vs/platform/product/common/product.ts
src/vs/platform/quickinput/browser/quickInputController.ts
@TylerLeonhardtsrc/vs/platform/quickinput/browser/quickInputService.ts
@TylerLeonhardtsrc/vs/platform/quickinput/browser/quickPickPin.ts
@TylerLeonhardtsrc/vs/platform/request/node/requestService.ts
@chrmartisrc/vs/platform/terminal/common/capabilities/commandDetectionCapability.ts
src/vs/platform/update/common/update.ts
@joaomorenosrc/vs/platform/utilityProcess/electron-main/utilityProcess.ts
src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts
@jriekensrc/vs/workbench/api/browser/mainThreadNotebook.ts
@rebornixsrc/vs/workbench/api/browser/mainThreadTask.ts
src/vs/workbench/api/common/extHost.api.impl.ts
@jriekensrc/vs/workbench/api/common/extHostDebugService.ts
@connor4312src/vs/workbench/api/common/extHostTypeConverters.ts
@jriekensrc/vs/workbench/browser/actions/quickAccessActions.ts
@TylerLeonhardtsrc/vs/workbench/browser/parts/editor/breadcrumbsControl.ts
@jriekensrc/vs/workbench/contrib/accessibility/browser/accessibleView.ts
src/vs/workbench/contrib/bulkEdit/browser/preview/bulkEditPane.ts
@jriekensrc/vs/workbench/contrib/chat/browser/actions/chatActions.ts
@roblourenssrc/vs/workbench/contrib/chat/browser/actions/chatImportExport.ts
@roblourenssrc/vs/workbench/contrib/chat/browser/actions/chatMoveActions.ts
@roblourenssrc/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.ts
src/vs/workbench/contrib/chat/common/chatModel.ts
@roblourenssrc/vs/workbench/contrib/editSessions/browser/editSessionsViews.ts
@alexr00src/vs/workbench/contrib/files/browser/explorerService.ts
@lramos15src/vs/workbench/contrib/interactive/browser/interactive.contribution.ts
@rebornixsrc/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts
@ulugbeknasrc/vs/workbench/contrib/preferences/browser/settingsTree.ts
@rzhao271src/vs/workbench/contrib/webview/browser/themeing.ts
@mjbvzsrc/vs/workbench/electron-sandbox/actions/windowActions.ts
src/vs/workbench/services/extensions/common/extensionsRegistry.ts
@alexdimasrc/vs/workbench/services/preferences/browser/keybindingsEditorModel.ts
@ulugbeknasrc/vs/workbench/services/preferences/common/preferencesModels.ts
@rzhao271src/vs/workbench/test/browser/workbenchTestServices.ts
@mjbvzThe text was updated successfully, but these errors were encountered: