Skip to content
Snippets Groups Projects
Unverified Commit 6d0bb151 authored by Ariya Hidayat's avatar Ariya Hidayat Committed by GitHub
Browse files

Add typing hints to `isa` to assist type inference (#17530)

This requires unfortunately an additional layer of indirection, however
I believe it's super cheap and it shouldn't impact execution speed.

In the mean time, many other predicates (isFoo etc) which rely on isa()
will be correctly type-inferred, which gives a huge win for editing and
debugging purposes.
parent ea56ae35
No related branches found
No related tags found
No related merge requests found
import { isa, TYPE } from "cljs/metabase.types";
import { isa as cljs_isa, TYPE } from "cljs/metabase.types";
export { isa, TYPE };
export { TYPE };
/**
* Is x the same as, or a descendant type of, y?
*
* @example
* isa(field.semantic_type, TYPE.Currency);
*
* @param {string} x
* @param {string} y
* @return {boolean}
*/
export const isa = (x, y) => cljs_isa(x, y);
// convenience functions since these operations are super-common
// this will also make it easier to tweak how these checks work in the future,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment