question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using dynamic values results in TypeScript errors inside VS Code

See original GitHub issue

Describe the bug When using a dynamic nested state for validation, TypeScript throws errors inside VS Code.

To Reproduce Steps to reproduce the behavior:

  1. Setup nuxt project with Typescript
  2. Create validation with nested state
  3. See error

Expected behavior No TS error should be thrown

Screenshots image Additional context Using version 2.0.0-alpha.34

I’m not very experienced with Typescript so chances are that i’m overlooking something, but i can’t find any way to resolve this.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
stigvanbrabantcommented, Apr 5, 2022

@A-Ghorab Ah didn’t know about that one, that does the trick! Thank you so much!

0reactions
cibilexcommented, Apr 8, 2022

I think this error is normal for this situation because you use a optional variable.I think you can use these ways to solve this problem 👍

  1. if control
  2. requiredIf control
  3. helpers.req(val)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic type validation in TypeScript - LogRocket Blog
It will check if performing any operation on a variable is possible given its type. Most people think that by using TypeScript as...
Read more >
Editor shows error on a valid TypeScript dynamic import ...
I have a second one in the folder with my source files, which extneds the one in the root folder, but for some...
Read more >
TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
Read more >
TypeScript Programming with Visual Studio Code
The TypeScript language service will analyze your program for coding problems and report errors and warnings: In the Status bar, there is a...
Read more >
Chapter 1. Getting familiar with TypeScript - liveBook · Manning
This error is caught by the TypeScript static code analyzer while you type, even before you compile this code with the Typescript compiler...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found