XrmDefinitelyTyped icon indicating copy to clipboard operation
XrmDefinitelyTyped copied to clipboard

TS2304 "Cannot find name" errors after generating types

Open ericregnier opened this issue 2 years ago • 6 comments

Repro steps:

  1. Create a new empty Web Application project in Visual Studio (using 2022)
  2. Using the latest version of XrmDefinitelyTyped (v6.1.0), generate typings. Here's an example of the config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
	  <appSettings>
		  <add key="url" value="https://dev.api.crm.dynamics.com/XRMServices/2011/Organization.svc" />
		  <add key="method" value="ClientSecret"/>
		  <add key="mfaAppId" value="appid" />
		  <add key="mfaClientSecret" value="secret" />
		  <add key="out" value="../typings/XRM" />
		  <add key="solutions" value="" />
		  <add key="entities" value="new_entity1, new_entity2" />
		  <add key="web" value="" />
		  <add key="jsLib" value="../src/lib" />
		  <add key="skipInactiveForms" value="true" />
		  <add key="generateMappings" value="true"/>
	  </appSettings>
</configuration>
  1. tsconfig.json example:
{
"compilerOptions": {
  "noImplicitAny": false,
  "noEmitOnError": false,
  "removeComments": false,
  "sourceMap": true,
  "target": "es2017"
},
"include": [ "./ts/**/*" ]
}
  1. Note: there's no package.json in the solution/directory
  2. Clean and build the VS solution

Actual Results:

  1. Heaps of TS2304 errors "(TS) Cannot find name XYZ" for enums and objects image

Expected Results: No build errors

ericregnier avatar Jun 07 '22 01:06 ericregnier

I have the same issue.

alloylo avatar Sep 20 '22 10:09 alloylo

the solution was just delete the generated types folder and regenerate again.

alloylo avatar Sep 21 '22 07:09 alloylo

Tried that, but no luck for me

ericregnier avatar Sep 26 '22 07:09 ericregnier

did you include the generated item files in the project.

alloylo avatar Sep 26 '22 07:09 alloylo

Yup I did, I have a Web Application (not Web Site) type of project

ericregnier avatar Sep 26 '22 07:09 ericregnier

@alloylo possible to share your tsconfig and XrmDefinitelyTyped config?

ericregnier avatar Sep 26 '22 07:09 ericregnier