Skip to content
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

TS2304 "Cannot find name" errors after generating types #275

Open
ericregnier opened this issue Jun 7, 2022 · 6 comments
Open

TS2304 "Cannot find name" errors after generating types #275

ericregnier opened this issue Jun 7, 2022 · 6 comments

Comments

@ericregnier
Copy link

ericregnier commented Jun 7, 2022

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

@alloylo
Copy link

alloylo commented Sep 20, 2022

I have the same issue.

@alloylo
Copy link

alloylo commented Sep 21, 2022

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

@ericregnier
Copy link
Author

Tried that, but no luck for me

@alloylo
Copy link

alloylo commented Sep 26, 2022

did you include the generated item files in the project.

@ericregnier
Copy link
Author

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

@ericregnier
Copy link
Author

@alloylo possible to share your tsconfig and XrmDefinitelyTyped config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants