Comments (5)
I'm not sure what's best here. We show
(property) a1: 1
But a2
isn't a property; it's an index signature. It'd be confusing to just show
number
here since "a2"
is not a number.
We've never had reason to show (index signature)
or whatnot here.
This doesn't seem like something people commonly encounter as a problem.
from typescript.
Note that this isn't just about twoslash hints, but extends to hover tips as well. It is kind of frustratingly inconsistent (for no apparent reason, from an end-user point of view) that hovering over ["a1"]
shows what type of value it's accessing, but not ["a2"]
. If you want to see that type you have to assign it to a const
first and hover over that.
from typescript.
How about number from [x: string]: number
? Works similarly to how we show type parameters as T in f<T>(): void
.
from typescript.
How about
number from [x: string]: number
? Works similarly to how we show type parameters asT in f<T>(): void
.怎么样number from [x: string]: number
?工作方式类似于我们将类型参数显示为T in f<T>(): void
.
This seems intuitive.
While I'm not sure what's best to show, I'm a little confused that typescript shows me nothing when I encounter this situation.
from typescript.
More information: If you destruct the object, then the type will be shown:
![](https://private-user-images.githubusercontent.com/63178754/340892939-042693d3-7bc8-4ee9-b8a5-be0eaa069868.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzODU3NzMsIm5iZiI6MTcyMTM4NTQ3MywicGF0aCI6Ii82MzE3ODc1NC8zNDA4OTI5MzktMDQyNjkzZDMtN2JjOC00ZWU5LWI4YTUtYmUwZWFhMDY5ODY4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE5VDEwMzc1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYwY2M1MmI0NzBkNzRiODQwODQyZjQ5MjgwZWJkZjllZWU4YTdkNGExZmU0ODJhOTY3ZTA0NzIwZWY0MTg5OTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.LYcf2kdmcQ43vlEoZbvUw9r4FfqGlLL1f9PKyl_TGcs)
from typescript.
Related Issues (20)
- Incorrect Error Message: "Cannot assign to 'name' because it is a constant" Instead of "Identifier 'name' is not defined" for Undefined Identifier Assignment HOT 2
- Generic with extends yields to different type than directly specifying it HOT 5
- Instantiation expressions don't reject incompatible signatures in situations with mixed call and construct signatures HOT 1
- Parameters of overridden methods are made implicit any when using JSDoc `@override` HOT 13
- 'TypeScript and JavaScript Language Features' Formatter hangs HOT 3
- Mapped type of a conditional type unexpectedly fails inference
- Returing a generic argument from a function allows returning a wrong type HOT 1
- Module resolution behaves differently when typeRoots is specified
- Ability to type check setters in interface implementations HOT 2
- ⚡ Performance: Project service spends excess time cleaning client files when called synchronously HOT 2
- ⚡ Performance: Project service doesn't cache all fs.statSync HOT 18
- jsxRuntime pragma does not work
- ThisType doesn't enforce type-checking `Object.prototype.call` HOT 2
- ⚡ Performance: Project service doesn't cache all fs.realpath HOT 1
- `null` prop with `satisfies`, `strictNullChecks: false` + `noImplicitAny: true` gives any report HOT 4
- Debugging failure caused by lack of backtick(`)
- [proposal] Non widened string values should be valid enum values, like widened string values HOT 1
- 'Could not find source file' with Vue plugin when creating new files and using VS Code's file watcher HOT 7
- Contextual parameters inferred from overloads improvements
- Debug Failure caused by missing right parenthesis
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript.