-
Notifications
You must be signed in to change notification settings - Fork 7
.parse is not available on TsjsonParser #10
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
Comments
That's odd. Which version of TypeScript are you using in your IDE? Intellisense should infer
There's no I've made a bunch of changes in the last 2 days, can you try latest master and see if you're still running into this issue? The generated code looks right, but can you check if the generated types match as well? tsjson-parser.d.ts should have something like
|
You can see this use here, with all of the deps defined in package.json: |
The IDE I'm using is VS Code (latest) |
Just cloned your repo and was able to replicate. Looks like you're using Typescript 3.6.4 (which is a totally reasonable thing to be doing.) However, When npm-installing in your repo, I get
Which I think is enough warning – but if you have an idea to make this more obvious, I'd welcome a suggestion/PR! I've confirmed that this works in the IDE using 3.7 in your repo. Closing this but feel free to reopen if you think I've missed something. |
Ok, thanks for looking into this. What features of TS 3.7 is it relying on that are not available in 3.6.4? Thanks. |
Interestingly, after the update, the tests are failing. export function caseTsJsonValidator(data: Data) {
return parser.validate(data)
} It seems return type of the function cannot be inferred and is set to Even though when hovering the return type of Any ideas? |
That's due to microsoft/TypeScript#34596 I'm going to change this to a normal type guard for now (so .validate will return |
This:
Gets compiled to:
And IDE cannot infer this as an available class method.
The text was updated successfully, but these errors were encountered: