masumsoft / express-cassandra

Cassandra ORM/ODM/OGM for NodeJS with support for Apache Cassandra, ScyllaDB, Datastax Enterprise, Elassandra & JanusGraph.
http://express-cassandra.readthedocs.io
GNU Lesser General Public License v3.0
232 stars 68 forks source link

Typescript defined Types #99

Open trinhvietnam opened 7 years ago

trinhvietnam commented 7 years ago

Please write Typescript defined Types for this module

phra commented 7 years ago

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

tybeck commented 7 years ago

+1

masumsoft commented 7 years ago

@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 commented 6 years ago

@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 commented 6 years ago

@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 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

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

abdatta commented 4 years ago

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

ktjd123 commented 4 years ago

Any update ? This will be so helpful for ts devs

MattNot commented 4 years ago

Any news?

officialpiyush commented 2 years ago

do we have any updates on this?

y-nk commented 2 years ago

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

masumsoft commented 2 years ago

Is it at least opened for PR ?

@y-nk yes PRs are welcome