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

Can not use declaritive import without esModuleInterop #410

Open
yo1dog opened this issue Oct 14, 2024 · 1 comment
Open

Can not use declaritive import without esModuleInterop #410

yo1dog opened this issue Oct 14, 2024 · 1 comment
Assignees
Labels
priority: medium This PR should be reviewed after all high priority PRs. status: in progress This issue is being worked on. type: chore This PR contains changes that are not covered by other types (stylistic, dependency updates, etc).

Comments

@yo1dog
Copy link

yo1dog commented Oct 14, 2024

Currently, the project-wide esModuleInterop flag must be enabled in order to import the pubnub module using declarative syntax (import * as PubNub from 'pubnub'). Alternatively, dynamic import syntax may be used (import PubNub = require('pubnub')), but that carries its own list of disadvantages.

This is fixed by simply declaring a PubNub namespace alongside the exported class like so:

declare class PubNub ...
declare namespace PubNub {}
export = PubNub;

This matches the DefinitelyTyped package: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pubnub/index.d.ts#L330

@parfeon parfeon self-assigned this Oct 29, 2024
@parfeon parfeon added status: in progress This issue is being worked on. priority: medium This PR should be reviewed after all high priority PRs. type: chore This PR contains changes that are not covered by other types (stylistic, dependency updates, etc). labels Oct 29, 2024
parfeon added a commit that referenced this issue Oct 30, 2024
Fix definition of type which represent message actions received from history and list of users which added action of specific type and value to the message.

Closes #407

refactor(types): remove indexed signature for publish

Remove redundant indexed signature from publish message parameters type definition.

Closes #413

refactor(types): add serializable objects to `Payload` type

Extend `Payload` type definition with objects which can be serialized by `JSON.stringify` using `toJSON()` methods.

Closes #412

refactor(types): aggregate generated types definitions

Aggregate multiple types definitions into single type definition type with proper type names and namespaces.

Closes #405 #409 #410

refactor(types): add missing Subscribe Event Engine types

Add Subscribe Event Engine and Event Listener types to the bundled types definition file.

Closes #377
parfeon added a commit that referenced this issue Oct 31, 2024
fix(types): fix `Actions` type definition

Fix definition of type which represent message actions received from history and list of users which added action of specific type and value to the message.

Closes #407

refactor(types): remove indexed signature for publish

Remove redundant indexed signature from publish message parameters type definition.

Closes #413

refactor(types): add serializable objects to `Payload` type

Extend `Payload` type definition with objects which can be serialized by `JSON.stringify` using `toJSON()` methods.

Closes #412

refactor(types): aggregate generated types definitions

Aggregate multiple types definitions into single type definition type with proper type names and namespaces.

Closes #405 #409 #410

refactor(types): add missing Subscribe Event Engine types

Add Subscribe Event Engine and Event Listener types to the bundled types definition file.

Closes #377
@parfeon
Copy link
Contributor

parfeon commented Oct 31, 2024

@yo1dog this issue is addressed in v8.2.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium This PR should be reviewed after all high priority PRs. status: in progress This issue is being worked on. type: chore This PR contains changes that are not covered by other types (stylistic, dependency updates, etc).
Projects
None yet
Development

No branches or pull requests

2 participants