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

Fix error in Conviva type definitions when Yospace is not installed #21

Merged
merged 5 commits into from
Apr 9, 2024

Conversation

MattiasBuelens
Copy link
Contributor

Previously, TypeScript users would get the following error when they've installed the Conviva connector without the (optional) Yospace connector dependency:

node_modules/@theoplayer/conviva-connector-web/dist/types/integration/ConvivaConnector.d.ts:3:39 - error TS2307: Cannot find module '@theoplayer/yospace-connector-web' or its corresponding type declarations.

3 import type { YospaceConnector } from '@theoplayer/yospace-connector-web';
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This PR works around this issue by adding a @ts-ignore comment above that import. If the dependency isn't installed, the imported type resolves to any, which is good enough.

Note that we need to use a JSDoc-style comment /** @ts-ignore */ in order for TypeScript to preserve it during emit. A bit hacky, but it works. 😛

Copy link

changeset-bot bot commented Apr 8, 2024

🦋 Changeset detected

Latest commit: 8044537

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@theoplayer/conviva-connector-web Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@MattiasBuelens
Copy link
Contributor Author

@tvanlaerhoven reported that there was still a runtime dependency on the Yospace connector, which Webpack didn't like.

This should also be fixed now.

@MattiasBuelens MattiasBuelens merged commit 4437786 into main Apr 9, 2024
1 check passed
@MattiasBuelens MattiasBuelens deleted the fix-yospace-in-conviva-types branch April 9, 2024 08:55
@MattiasBuelens MattiasBuelens added 🔌 connector: conviva Affects the Conviva connector bug Something isn't working labels Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🔌 connector: conviva Affects the Conviva connector
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants