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

Implement `ignoreLocations` option for each RTI plugin #78

Closed kungfooman closed 8 months ago

kungfooman commented 9 months ago

As mentioned here:

https://github.com/kungfooman/RuntimeTypeInspector.js/blob/cf0a5b8e1ad534662be6f6ef316a18b6ac64c88e/plugin-rollup/index.mjs#L39-L44

Why?

In order to find the most possible bugs, I basically treat +-Infinity and NaN whenever I find them as a potential error. Yet some functions/methods use them consciously, like in the case of Transformers.js (where the logits processor on the first few runs is processing Float32Array's where all elements are -Infinity except one, which forces certain special tokens to be generated).

In short, if a location is white listed in the ignorelocations array, it will not generate a type error.

On the other hand, if another kind of type error would happen in the same function, it wouldn't generate a type error either.

So I'm still trying to find the easiest and most precise way to create a precise white list here.

kungfooman commented 8 months ago

On the other hand, if another kind of type error would happen in the same function, it wouldn't generate a type error either.

Currently I skip error validation code generation for error locations in the ignoreLocations array - however, I can also imagine to add a runtime option to show them anyway, but with a special "marking" to them... lets say with an orange text or background, because they are "expected derivations from the norm".