Skip to content

Fix type definition issues in the constructors #321

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

Merged
merged 3 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ v1.3.1 is a maintenance release. It is supported for all usage.

## Fixes

1. Avoid a race condition that causes 100% usage of a CPU core when
1. Avoid a race condition that causes 100% usage of a CPU core when
consuming with `partitionsConsumedConcurrently > 1` and all messages
are consumed (#300)
2. Fix type definition for `Kafka()` constructor and for passing topic configurations
to the `producer()` and `consumer()` in the promisified API (@davidkhala, #297, #321).


# confluent-kafka-javascript v1.3.0
Expand Down
17 changes: 13 additions & 4 deletions types/kafkajs.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { ConsumerGlobalConfig, GlobalConfig, ProducerGlobalConfig } from './config'
import {
ConsumerGlobalConfig,
ConsumerTopicConfig,
GlobalConfig,
ProducerGlobalConfig,
ProducerTopicConfig } from './config'
import {
ConsumerGroupStates,
GroupOverview,
Expand Down Expand Up @@ -94,7 +99,7 @@ export interface CommonConstructorConfig extends GlobalConfig {
}

export class Kafka {
constructor(config: CommonConstructorConfig)
constructor(config?: CommonConstructorConfig)
producer(config?: ProducerConstructorConfig): Producer
consumer(config: ConsumerConstructorConfig): Consumer
admin(config?: AdminConstructorConfig): Admin
Expand Down Expand Up @@ -131,7 +136,9 @@ export interface ProducerConfig {
logger?: Logger,
}

export interface ProducerConstructorConfig extends ProducerGlobalConfig {
type ProducerGlobalAndTopicConfig = ProducerGlobalConfig & ProducerTopicConfig;

export interface ProducerConstructorConfig extends ProducerGlobalAndTopicConfig {
kafkaJS?: ProducerConfig;
}

Expand Down Expand Up @@ -235,7 +242,9 @@ export interface ConsumerConfig {
partitionAssignors?: PartitionAssignors[],
}

export interface ConsumerConstructorConfig extends ConsumerGlobalConfig {
export type ConsumerGlobalAndTopicConfig = ConsumerGlobalConfig & ConsumerTopicConfig;

export interface ConsumerConstructorConfig extends ConsumerGlobalAndTopicConfig {
kafkaJS?: ConsumerConfig;
}

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy