We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I've using Mosaic from within TypeScript so I authored some type declarations.
I don't stand by their correctness, but in the process of doing so, I noticed a type mismatch that might lead to bugs.
Coordinator calls a client's fields() method, and expects the client to return an array of objects with roughly this type:
fields()
export interface Field { table: string; column: string; stats?: Set<keyof typeof Stats> | (keyof typeof Stats)[]; }
As you can see here:
mosaic/packages/core/src/Coordinator.js
Lines 138 to 141 in 04d68e1
and here:
mosaic/packages/core/src/util/field-info.js
Lines 26 to 34 in 04d68e1
Lines 71 to 80 in 04d68e1
However, in some of the clients, like Table, the fields method implementation looks like this:
mosaic/packages/inputs/src/Table.js
Lines 90 to 92 in 04d68e1
which uses this method on Ref that returns a new instance of Ref:
mosaic/packages/sql/src/ref.js
Lines 94 to 100 in 04d68e1
However, Ref does not require that the table and column properties are non-null, as you can see in the toString() method:
table
column
toString()
Lines 27 to 36 in 04d68e1
So, in cases like this where we use a Ref as if it implemented Field without any checks, we might end up using null as if it were a string.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I've using Mosaic from within TypeScript so I authored some type declarations.
I don't stand by their correctness, but in the process of doing so, I noticed a type mismatch that might lead to bugs.
Coordinator calls a client's
fields()
method, and expects the client to return an array of objects with roughly this type:As you can see here:
mosaic/packages/core/src/Coordinator.js
Lines 138 to 141 in 04d68e1
and here:
mosaic/packages/core/src/util/field-info.js
Lines 26 to 34 in 04d68e1
and here:
mosaic/packages/core/src/util/field-info.js
Lines 71 to 80 in 04d68e1
However, in some of the clients, like Table, the fields method implementation looks like this:
mosaic/packages/inputs/src/Table.js
Lines 90 to 92 in 04d68e1
which uses this method on Ref that returns a new instance of Ref:
mosaic/packages/sql/src/ref.js
Lines 94 to 100 in 04d68e1
However, Ref does not require that the
table
andcolumn
properties are non-null, as you can see in thetoString()
method:mosaic/packages/sql/src/ref.js
Lines 27 to 36 in 04d68e1
So, in cases like this where we use a Ref as if it implemented Field without any checks, we might end up using null as if it were a string.
The text was updated successfully, but these errors were encountered: