XrmDefinitelyTyped
XrmDefinitelyTyped copied to clipboard
TS2304 "Cannot find name" errors after generating types
Repro steps:
- Create a new empty Web Application project in Visual Studio (using 2022)
- 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>
- tsconfig.json example:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": false,
"removeComments": false,
"sourceMap": true,
"target": "es2017"
},
"include": [ "./ts/**/*" ]
}
- Note: there's no package.json in the solution/directory
- Clean and build the VS solution
Actual Results:
- Heaps of TS2304 errors "(TS) Cannot find name XYZ" for enums and objects
Expected Results: No build errors
I have the same issue.
the solution was just delete the generated types folder and regenerate again.
Tried that, but no luck for me
did you include the generated item files in the project.
Yup I did, I have a Web Application (not Web Site) type of project
@alloylo possible to share your tsconfig and XrmDefinitelyTyped config?