-
Notifications
You must be signed in to change notification settings - Fork 117
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
Poor IDE errors on some types #173
Comments
@DanielRosenwasser Can you shed some light here? Our understanding was that TS3.0+ would help out here by whittling things down the properties that are the problem. Is there some reason that isn't happening? A config error on our side perhaps? Or is there something about these types that leads to TS feeling like it can't trim this down? |
I should note that this is using TypeScript 3.0.3 for the project and VS Code is version 1.26.1 at version 3.0.1 of TypeScript (or so I assume, given that this is in the right hand corner): Also worth noting that these types use our |
Sorry guys: microsoft/TypeScript#25695 Please leave feedback there and feel free to link back here! |
@DanielRosenwasser Actually, we're still seeing an issue even when not using an argument. i.e.: Known issue as well? |
I think the problem there is that we're comparing to a union type which limits our ability to confidently specialize the error. Maybe microsoft/TypeScript#26450 would help there. |
I see. That would likely definitely affect us. We have a union type which likely is the source of the issue (given the message about
Meaning: you can pass in a raw T value. Or you can pass something that asynchronously produces a T. Or you provide a 'node' (Output) into our graph, which itself has a value. With our factories these types are recursively contained within themselves. After all, you could take something that asynchronously produces a value, which itself has properties which are asynchronously produced. From a representation level, TS really makes it easy for us to describe this system. However, from an errors perspective, it really leaves a lot to be desired :) Def would love to see stuff help out here. |
Is there anything we can do to improve here prior to fixes/improvements on the TypeScript side? My assumption is unfortunately no (short of somehow not using the |
Moving out as i don't see anything feasible here. We're effectively at the mercy of microsoft/TypeScript#26450. |
Let's just close and as TypeScript improves, we will improve. It seems there's nothing we can really do other than abandoning our union types (which clearly can't happen). |
I was trying to write a blog post to demonstrate some of the benefits of having real code in an IDE: namely, interactive error messages for typos, type errors, and so on. Unfortunately, the first several times I tried, the error messages were in fact not very good. I am using our Kubernetes template project from https://github.com/pulumi/templates/tree/master/kubernetes-typescript, and I've filed this issue here because I suspect the problem might be in the way we've laid out our Kubernetes types.
I am assigning to @CyrusNajmabadi for now because he graciously offered to help track this down.
Example 1
Put a string in the
replicas
property, when it expects a number:Example 2
Mistype the
replicas
property altogether:Typings
Here are the types in question for this example:
Deployment
class:pulumi-kubernetes/pack/nodejs/provider.ts
Line 2924 in d6d60ca
constructor
accepts a differentDeployment
interface type:pulumi-kubernetes/pack/nodejs/provider.ts
Line 2967 in d6d60ca
Deployment
interface:pulumi-kubernetes/pack/nodejs/types/input.ts
Line 1392 in d6d60ca
spec
property which is of theDeploymentSpec
interface:pulumi-kubernetes/pack/nodejs/types/input.ts
Line 2394 in d6d60ca
replicas
property of that interface:pulumi-kubernetes/pack/nodejs/types/input.ts
Line 2425 in d6d60ca
The text was updated successfully, but these errors were encountered: