https://github.com/danvk/any-xray
X-Ray Glasses for TypeScript any Types
https://github.com/danvk/any-xray
Last synced: 10 months ago
JSON representation
X-Ray Glasses for TypeScript any Types
- Host: GitHub
- URL: https://github.com/danvk/any-xray
- Owner: danvk
- License: apache-2.0
- Created: 2024-09-29T18:21:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-09T21:03:41.000Z (almost 2 years ago)
- Last Synced: 2024-12-31T21:42:42.250Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=danvk.any-xray
- Size: 1010 KB
- Stars: 28
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# any-xray
X-Ray vision for pesky `any` types.
## Features
Dangerous `any` types can come from surprising places in TypeScript. This VS Code extension makes all identifiers with an `any` type stand out.

## Extension Settings
`anyXray.anyStyle`
Change the way that symbols with `any` types are rendered. You can pass in anything assignable to [`DecorationRenderOptions`][style]. The default is:
```json
{
"backgroundColor": "rgba(255,0,0,0.1)",
"borderRadius": "3px",
"border": "solid 1px rgba(255,0,0)",
"color": "red"
}
```
## Related work
- If you want `any` types to be compiler warnings, check out [type-coverage].
- You may also be interested in typescript-eslint's [no-unsafe-assignment] rule, which is part of the [recommended-type-checked] configuration.
## How this works
This extension piggybacks on the "quickinfo" (hovertext) provided by the TypeScript Language Service in VS Code. It parses your TypeScript file and asks VS Code for quickinfo on all the identifiers in the visible range of active editors. If these end with something like ": any", then it colors them red.
There are a few situations in which this will highlight identifiers that are safe, see [#1](https://github.com/danvk/any-xray/issues/1).
[type-coverage]: https://github.com/plantain-00/type-coverage
[no-unsafe-assignment]: https://typescript-eslint.io/rules/no-unsafe-assignment/
[recommended-type-checked]: https://typescript-eslint.io/users/configs/#recommended-type-checked
[style]: https://code.visualstudio.com/api/references/vscode-api#DecorationRenderOptions