Closed MichaelBuhler closed 2 years ago
Thanks @MichaelBuhler!
@MichaelBuhler Unfortunately this messes with our docs generation: https://github.com/geotiffjs/geotiff.js/runs/5739344764?check_suite_focus=true#step:5:10
Hmm. Sorry about that. I can look for a solution.
This is related to https://github.com/jsdoc/jsdoc/issues/1285.
The types I wrote works in my IDE (WebStorm) but is not supported by JSDoc. I will investigate Closure Compiler type expressions.
Well, I have been reading for an hour. This seems impossible to fix. JSDoc will never support TypeScript intersection types.
If we change the &
to a |
, the docs will generate, but TS won't like it. There is a JSDoc plugin called https://github.com/chriseaton/jsdoc-plugin-intersection which will convert the &
to a |
only during doc generation, but leave it in the source so that the generated TypeScript type is correct. @constantinius If you want me to implement this plugin in this repo, let me know.
We can revert this PR to fix the build. 😞
@MichaelBuhler I see. Can we try the plugin? I'd rather not revert, as you already put so much effort into it.
Problem
According to the README (as quoted below), a call to
readRasters()
attachesheight
andwidth
to the returned array.Before this PR, the return type of
readRasters()
wasPromise<TypedArray | TypedArray[]>
, which does not include theheight
andwidth
fields.According to README.md
For convenience the result always has a width and height attribute:
Solution
Alter the return type of
readRasters()
to a new type namedReadRasterResult
, which extendsTypedArray | TypedArray[]
to include{ height: number; width: number }
.