luma.gl icon indicating copy to clipboard operation
luma.gl copied to clipboard

Typescript module name pollution of 'utils'

Open kahole opened this issue 8 months ago • 0 comments

There are some module exports from luma.gl/webgl that take on a very common path, namely utils

This export line and an export in webgl-statetracker,

https://github.com/visgl/luma.gl/blob/a25cd26e6ad4df757b02004270c9c1872566c76f/modules/webgl/src/index.js#L64

make it all the way out to the top level as:

declare module 'utils' {
  export { default as assert } from '@luma.gl/webgl-state-tracker/utils/assert';
  export { default as deepArrayEqual } from '@luma.gl/webgl-state-tracker/utils/deep-array-equal';
  export { isWebGL2, isObjectEmpty } from '@luma.gl/webgl-state-tracker/utils/utils';
}

I'm no expert in this, but this seems a bit pollutive and possibly accidental. Nothing too critical though, the workaround is quite easy:

tsconfig:

    "paths": {
      "utils": ["./path/to/your/local/utils"]
    },

kahole avatar Nov 05 '23 12:11 kahole