Severity: error | Blocks morph build: yes
Status: documented rule —
morph checkdoes not report this code yet. The underlying problem still breaks your build or your UI; the cause and fix below apply when you hit it.
You access a member of a JS builtin object Morph does not implement — Math.*,
JSON.*, Date.*, RegExp.*, or console.* beyond
log/warn/error/info:
error : mx-js-member : Unsupported member `JSON.parse` — no native counterpart
hint: Parse with explicit conversion code or a `.cpp` helper
Learn more: https://morph.levizr.com/docs/errors/mx-js-memberMorph's runtime types (JsNumber, JsString, JsArray, JsObject — see
runtime types) implement a curated subset of
JavaScript semantics with zero-overhead native backing. Members outside that
subset (Math.hypot, JSON.parse, Date.now, RegExp, console.table)
have no implementation to call into. Rather than stubbing them with wrong
semantics, Morph rejects the access and points at the replacement.
// ❌ JSON.parse is not implemented — mx-js-member
export default function App() {
const data = JSON.parse('{"n": 1}');
return <div>Hello</div>;
}// ❌ console.table is not implemented (log/warn/error/info are) — mx-js-member
export default function App() {
console.table([1, 2, 3]);
return <div>Hello</div>;
}// ✅ console.log/warn/error/info are supported
export default function App() {
console.log("rendered");
return <div>Hello</div>;
}For the rest, options in order of preference:
.cpp helper — implement it natively and import it (see
native C++).// ✅ Native helper for unsupported builtins
import { parseCount } from './helpers.cpp';
export default function App() {
return <div>{parseCount("3")}</div>;
}Steps:
.cpp function and import it.morph check.Do not disable this rule. Unimplemented members have no code to call.