Skip to content

Commit

Permalink
Use the primitive "number" type instead of the object counterpart "Nu…
Browse files Browse the repository at this point in the history
…mber" to avoid a jscompiler error.

An upcoming change to J2CL that simplifies how casting logic is transpiled will make the code "(Number) (Object) 3" here transpile to just "/** @type {Number} */ (3)" and jscompiler will see the "invalid cast" since "3" is not "Number" in the closure type system.

RELNOTES=n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225046969
  • Loading branch information
rluble authored and ronshapiro committed Dec 12, 2018
1 parent 3dfee64 commit e41e8d1
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -67,7 +67,7 @@ static native String emptyToNull(@Nullable String string) /*-{
return string || null;
}-*/;

@JsType(isNative = true, name = "Number", namespace = GLOBAL)
@JsType(isNative = true, name = "number", namespace = GLOBAL)
private interface Number {
double toPrecision(int precision);
}
Expand Down

0 comments on commit e41e8d1

Please sign in to comment.