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

Typescript defined Types #99

Open
trinhvietnam opened this issue Apr 11, 2017 · 14 comments
Open

Typescript defined Types #99

trinhvietnam opened this issue Apr 11, 2017 · 14 comments

Comments

@trinhvietnam
Copy link

Please write Typescript defined Types for this module

@phra
Copy link

phra commented Apr 14, 2017

i definitely agree. also when using plain javascript you can benefit from that with editor like vscode. so 👍 by me!

@tybeck
Copy link

tybeck commented Jul 6, 2017

+1

@masumsoft
Copy link
Owner

@jcbarton I remember you had developed some sort of decorator package for TypeScript to use with express-cassandra loadSchema. Do you have any thoughts regarding this?

@rennanboni
Copy link

@masumsoft if you're interested I'm re-writing the express-cassandra to TypeScript
That'll help with TypeScript definition and future plugin of plugin with lerna

@masumsoft
Copy link
Owner

@rennanboni is it possible to wrap express-cassandra to additionally provide typescript types support, so it can easily get future updates? I've never used typescript, so it won't be very comfortable for me to maintain it if re-written from scratch.

@rennanboni
Copy link

Hi @masumsoft, sorry for the delay,

Actually it is possible, and I was using similar idea long time ago, still a working in progress as you can see there is few methods declared
Using this declaration on typeping.d.ts the IDEA can help with autocomplete

declare module 'express-cassandra' {
  export function uuid(): string;
  export let instance: ExpressCassandraInstance;

  export class ExpressCassandraInstance {
    [key: string]: ExpressCassandraSearch;
  }

  export interface ExpressCassandraSearch {
    find(query: any, options: ExpressCassandraSearchOptions, callback: (err, result: any) => void);
    findOne(query: any, options: ExpressCassandraSearchOptions, callback: (err, result: any) => void);
    eachRow(query: any, options: ExpressCassandraSearchOptions, eachRow: (n, row: any) => void, callback: (err, result: ExpressCassandraPageModel) => void);
  }

  export class ExpressCassandraSearchOptions {
    materialized_view?: string;
    fetchSize?: number;
    raw?: boolean;
    pageState?: string;
    select?: string[];
  }

  export class ExpressCassandraPageModel {
    pageState: string;
  }
}

@Cleomir
Copy link

Cleomir commented Nov 11, 2018

Hi @masumsoft, sorry for the delay,

Actually it is possible, and I was using similar idea long time ago, still a working in progress as you can see there is few methods declared
Using this declaration on typeping.d.ts the IDEA can help with autocomplete

declare module 'express-cassandra' {
  export function uuid(): string;
  export let instance: ExpressCassandraInstance;

  export class ExpressCassandraInstance {
    [key: string]: ExpressCassandraSearch;
  }

  export interface ExpressCassandraSearch {
    find(query: any, options: ExpressCassandraSearchOptions, callback: (err, result: any) => void);
    findOne(query: any, options: ExpressCassandraSearchOptions, callback: (err, result: any) => void);
    eachRow(query: any, options: ExpressCassandraSearchOptions, eachRow: (n, row: any) => void, callback: (err, result: ExpressCassandraPageModel) => void);
  }

  export class ExpressCassandraSearchOptions {
    materialized_view?: string;
    fetchSize?: number;
    raw?: boolean;
    pageState?: string;
    select?: string[];
  }

  export class ExpressCassandraPageModel {
    pageState: string;
  }
}

How long will it take to finish it?

@Lucria
Copy link

Lucria commented May 21, 2020

Hii this will be a great addition. Any updates on Typescript defined Types?

@abdatta
Copy link

abdatta commented May 27, 2020

Hey guys, any updates with this? Typescript support will be so helpful! Thanks!

@ktjd123
Copy link

ktjd123 commented Jun 7, 2020

Any update ? This will be so helpful for ts devs

@MattNot
Copy link

MattNot commented Aug 7, 2020

Any news?

@officialpiyush
Copy link

do we have any updates on this?

@y-nk
Copy link

y-nk commented Jan 14, 2022

Issue was opened 5 years ago. Still not a priority. Is it at least opened for PR ?

@masumsoft
Copy link
Owner

Is it at least opened for PR ?

@y-nk yes PRs are welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests