Skip to content

We are getting types issues when using with typescript. #77

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

Open
awais-satti opened this issue May 6, 2021 · 1 comment
Open

We are getting types issues when using with typescript. #77

awais-satti opened this issue May 6, 2021 · 1 comment

Comments

@awais-satti
Copy link

Do you guys have types available for the extension?

@depyronick
Copy link

something... like this...

declare module "@apla/clickhouse" {
	import { Duplex } from 'stream';

	interface ClickHouseOptions {
		host?: string;
		user?: string;
		password?: string;
		dataObjects?: boolean;
		path?: string;
		format?: string;
		readonly?: boolean;
		queryOptions?: { [key: string]: any };
	}

	interface Meta {
		name: string;
		type: string;
	}

	interface Statistics {
		elapsed: number;
		rows_read: number;
		bytes_read: number;
		transferred: number;
	}


	interface QueryingResult {
		meta: Meta[];
		data: any[];
		rows: number;
		statistics: Statistics
	}

	interface ClickHouse {
		new(opts: ClickHouseOptions): this;

		query(query: string, options?: ClickHouseOptions, callback?: (error, result) => void): Duplex;
		querying(query: string, options?: ClickHouseOptions): Promise<QueryingResult>;
		ping(callback: (error: any, result: any) => void): Duplex;
		pinging(): Promise<any>
	}

	const ClickHouse: ClickHouse;

	export = ClickHouse;
}

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

No branches or pull requests

2 participants