kungfooman / RuntimeTypeInspector.js

Checking JSDoc types at runtime for high-quality types - Trust is good, control is better.
MIT License
8 stars 0 forks source link

Validate named imports in JSDoc #136

Closed kungfooman closed 4 months ago

kungfooman commented 4 months ago

image

Resulting from code like this:

import * as MathUtil from '../math-util.js';
/**
 * @param {MathUtil.Vector3} vector 
 * @param {number} timestampS 
 */
ComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) {
  this.currentGyroMeasurement.set(vector, timestampS);
  const deltaT = timestampS - this.previousGyroMeasurement.timestampS;
  if (Util.isTimestampDeltaValid(deltaT)) {
    this.run_();
  }
  this.previousGyroMeasurement.copy(this.currentGyroMeasurement);
};
kungfooman commented 4 months ago

In order to fix this properly, I need to register every possible type of imports.

Then we can also validate types like typeof import('whatever').Whatever... looking forward to implement this :sweat_smile: