Skip to content

export typescript types in package.json#50

Merged
MSNev merged 1 commit intomicrosoft:mainfrom
RikSchefferAmsterdam:main
Jul 2, 2024
Merged

export typescript types in package.json#50
MSNev merged 1 commit intomicrosoft:mainfrom
RikSchefferAmsterdam:main

Conversation

@RikSchefferAmsterdam
Copy link
Contributor

When adding this import to a react native project import {ReactNativePlugin} from '@microsoft/applicationinsights-react-native', I get the following error:

Could not find a declaration file for module '@microsoft/applicationinsights-react-native'. '/Users/rik/workspace/aapp_app_mobile/node_modules/@microsoft/applicationinsights-react-native/dist-esm/index.js' implicitly has an 'any' type.
  There are types at '/Users/rik/workspace/aapp_app_mobile/node_modules/@microsoft/applicationinsights-react-native/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@microsoft/applicationinsights-react-native' library may need to update its package.json or typings.ts(7016)

This can easily be solved be changes the package.json exports. So therefore I made this pull requests.

@MSNev MSNev requested a review from siyuniu-ms June 4, 2024 19:50
@siyuniu-ms
Copy link
Contributor

siyuniu-ms commented Jun 4, 2024

https://webpack.js.org/guides/package-exports/#conditions
based on this doc, this syntax is correct.
Test via sample app, works good locally.

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

Successfully merging this pull request may close these issues.

3 participants