Add return type definitions to datasources#63
Conversation
|
|
||
| abstract cancel(); | ||
| // @todo Set return type as Promise<void> ? | ||
| abstract cancel(): void | Promise<void>; |
There was a problem hiding this comment.
BigQuery, MySQL and PostgreSQL uses Promise, but other not use.
I suggest to every datasource returns Promise<void>.
|
|
||
| abstract connectionTest(); | ||
| // @todo Define type of the result (boolean or void ?) | ||
| abstract connectionTest(): Promise<any>; |
There was a problem hiding this comment.
Datasources have different return value type.
(true or void)
I suggest to use Promise<void>.
| return this._execute(query); | ||
| } | ||
|
|
||
| async cancel() { |
There was a problem hiding this comment.
sqlite_interrupt seems to be synchronized.
TryGhost/node-sqlite3#518
| return true; | ||
| } | ||
|
|
||
| async fetchTables() { |
There was a problem hiding this comment.
NOTE: If we update @google-cloud/bigquery to latest, we can use its type definition for typescript.
https://github.com/googleapis/nodejs-bigquery
(But I don't have the environment for testing)
| export type ConfigSchemaType = { | ||
| readonly name: string; | ||
| readonly label: string; | ||
| readonly type: string; |
There was a problem hiding this comment.
It can be expressed like:
readonly type: "radio" | "checkbox" | "password" | "string" | "number";I prefer to use union type.
|
Great works, thanks! |
Define return types for DataSources.
I plan to add typedef for charts, queries and React components (Props and State).