Typescript Errors How do I ignore the error property does not exist on value of type

0 votes

In VS2013 building stops when tsc exits with code 1. This was not the case in VS2012.

How do I handle the tsc.exe error?

I get many `The property 'x' does not exist on value of type 'y'` errors, which I want to ignore when using JS functions.

May 31, 2022 in TypeSript by Logan
• 2,140 points
12,429 views

1 answer to this question.

0 votes

The easiest solution to this is:

(y as any).x

This cast is explicit so it will compile even with noImplicitAny flag set.

answered May 31, 2022 by Nina
• 3,060 points
0 votes

to ignore it globally, in your tsconfig.json, do this:

{
  "compilerOptions": {
    "useUnknownInCatchVariables": false
  }
}
answered Jul 26, 2023 by john

edited Mar 5

Related Questions In TypeSript

0 votes
1 answer

Using TypeScript, and Object.assign gives me an error "property 'assign' does not exist on type 'ObjectConstructor'"

You can use type assertion, like this: (<any>Object).as ...READ MORE

answered Aug 3, 2022 in TypeSript by Abhinaya
• 1,160 points
6,160 views
0 votes
1 answer
0 votes
1 answer

Now I know what 'pick' does. But I want to do the opposite and remove values from an object.

You can use the keyword Omit for ...READ MORE

answered May 27, 2022 in TypeSript by Nina
• 3,060 points
1,193 views
0 votes
1 answer

What does the ! (exclamation mark) do in TypeScript?

The exclamation mark is called the non-null ...READ MORE

answered Jun 1, 2022 in TypeSript by Nina
• 3,060 points
1,547 views
0 votes
1 answer

Mixing JavaScript and TypeScript in Node.js

Combine the following TypeScript compiler options --allowJs Explicitly supports ...READ MORE

answered Jun 15, 2022 in TypeSript by Nina
• 3,060 points
1,195 views