express-cassandra icon indicating copy to clipboard operation
express-cassandra copied to clipboard

Typescript defined Types

Open trinhvietnam opened this issue 7 years ago • 14 comments

Please write Typescript defined Types for this module

trinhvietnam avatar Apr 11 '17 04:04 trinhvietnam

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

phra avatar Apr 14 '17 23:04 phra

+1

tybeck avatar Jul 06 '17 15:07 tybeck

@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?

masumsoft avatar Oct 24 '17 03:10 masumsoft

@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

rennanboni avatar Jul 29 '18 15:07 rennanboni

@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.

masumsoft avatar Jul 30 '18 02:07 masumsoft

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;
  }
}

rennanboni avatar Nov 05 '18 13:11 rennanboni

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?

Cleomir avatar Nov 11 '18 13:11 Cleomir

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

Lucria avatar May 21 '20 09:05 Lucria

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

abdatta avatar May 27 '20 04:05 abdatta

Any update ? This will be so helpful for ts devs

ktjd123 avatar Jun 07 '20 10:06 ktjd123

Any news?

MattNot avatar Aug 07 '20 09:08 MattNot

do we have any updates on this?

officialpiyush avatar Dec 20 '21 12:12 officialpiyush

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

y-nk avatar Jan 14 '22 10:01 y-nk

Is it at least opened for PR ?

@y-nk yes PRs are welcome

masumsoft avatar Jan 15 '22 21:01 masumsoft