Add return type definitions to datasources#63
Merged
hokaccha merged 1 commit intobdash-app:masterfrom Dec 3, 2019
Merged
Conversation
mtgto
commented
Dec 1, 2019
|
|
||
| abstract cancel(); | ||
| // @todo Set return type as Promise<void> ? | ||
| abstract cancel(): void | Promise<void>; |
Collaborator
Author
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>.
mtgto
commented
Dec 1, 2019
|
|
||
| abstract connectionTest(); | ||
| // @todo Define type of the result (boolean or void ?) | ||
| abstract connectionTest(): Promise<any>; |
Collaborator
Author
There was a problem hiding this comment.
Datasources have different return value type.
(true or void)
I suggest to use Promise<void>.
mtgto
commented
Dec 1, 2019
| return this._execute(query); | ||
| } | ||
|
|
||
| async cancel() { |
Collaborator
Author
There was a problem hiding this comment.
sqlite_interrupt seems to be synchronized.
TryGhost/node-sqlite3#518
mtgto
commented
Dec 1, 2019
| return true; | ||
| } | ||
|
|
||
| async fetchTables() { |
Collaborator
Author
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)
mtgto
commented
Dec 1, 2019
| export type ConfigSchemaType = { | ||
| readonly name: string; | ||
| readonly label: string; | ||
| readonly type: string; |
Collaborator
Author
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.
Member
|
Great works, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Define return types for DataSources.
I plan to add typedef for charts, queries and React components (Props and State).