Wrong type definition for .findOAuthInfo in js api 4.10

170
3
01-07-2019 07:38 AM
deleted-user-OOe4JK-9Abnm
New Contributor III

Hi,

I have just discovered a bug in index.d.ts in

"@types/arcgis-js-api": "^4.10.0",
findOauthInfo(url: string): OAuthInfo;

It must by capital A -> findOAuthInfo.

The same typo in the documentation: IdentityManager | API Reference | ArcGIS API for JavaScript 4.10 

Now I have to use js api 4.10 with old types @types/arcgis-js-api@4.9.0

Could you fix it, please

0 Kudos
3 Replies
KellyHutchins
Esri Frequent Contributor

Thanks for reporting the issue we'll get the doc (and typings) fixed.  When I run into situations like this I create a file in my project called updates.d.ts and 'fix' the typo in that file similar to the instructions outlined here: 

How to overwrite incorrect TypeScript type definition installed via @types/package - Stack Overflow 

That way you can continue to use the 4.10 typings and when the new typings are available you can just delete the update file. 

0 Kudos
deleted-user-OOe4JK-9Abnm
New Contributor III

Thank you for the answer!

I would be nice if you could fix this typo in the next version of api.

I will override as you suggested!

0 Kudos
deleted-user-OOe4JK-9Abnm
New Contributor III

Hi,

I just want to describe how I overridden the esri's type definition.

1. Create a folder typings/arcgis-js-api

2. Copy type definition file from node_modules/@types/arcgis-js-api/index.d.ts to the new folder (typings/arcgis-js-api)

3. Make changes in the type definitions.

4. Add in tsconfig.json:

"compilerOptions": {
...
"typeRoots": [
"./node_modules/@types",
"./typings/",
]
}

5. Restart your project "npm start"

Good luck!!!

0 Kudos