Skip to content
These are temporary community docs. The official docs are in progress.Help improve them
Markless
Esc
↑↓navigate↵open⌘Jpreview
On this page

MARKLESS_SHARED_METHOD_CROSS_MODULE

A shared() method cannot be called from another module yet (<shared>): a Markless compiler error.

Error from the compiler, while it builds your .tsrx files.

What happened

Markless prints the message, the reason, and a suggestion:

MARKLESS_SHARED_METHOD_CROSS_MODULE: The emitted <kind> module for <symbolId> was built by copying the body of <shared> out of <files> into this file. <where> <what>
Calling a shared() method compiles to copying the method's authored body into the calling handler, because no shared instance exists inside a handler module to call the method on. Copying text moves the statements but not the scope they were written in, so the copy only means what the author wrote while the definition and the call are in one file. Across files the definition module's imports and module-scope declarations do not travel, and the calling module's imports are matched against the copied text by name, which can capture a same-named binding that means something else entirely. Both failures are invisible until the gesture runs, so this build refuses instead.
Call <value> from a part the family itself publishes, in <files>, and compose that part here. Inside its own module the same call compiles and runs today.
https://markless.dev/errors/MARKLESS_SHARED_METHOD_CROSS_MODULE

Words in angle brackets change from case to case.

How to fix it

Start with the suggestion in the message above.

This page has no guide yet. Help write it.

Where it comes from

@markless/compiler raises this code. Source:

Read how to read a Markless error, or go back to all error codes.

Was this page helpful?