EnglishSwitch to English
打开导航

错误码

v1.0.0-alpha.9 面共有 25 个 OEC 编译器诊断与 3 个运行时错误码。下表每一行都由触发它的源码渲染而成。

01 / 码表

错误码,以及它们被触发的位置。

OEC90xx 系列是编译器诊断:每个码对应一条编译元素边界强制执行的语法规则,每一行列出构建产生它的确切源码调用点。运行时错误码是应用可以分支处理的 ErrorCode 常量。码不可能只出现在源码里而不出现在这里。

OEC9000编译器语法

diagnosticMessage(…)

internal/compiler/semantic-core/compiler-diagnostics.ts:67
OEC9001编译器语法

expected exactly one @element(...) class per compiled module (the decorator must bind the canonical element import from '@openelement/element')

internal/compiler/semantic-core/analyze-module.ts:731
OEC9002编译器语法

@element option "…" may appear only once

9 条不同消息: @element option "…" may appear only once · @element options must be an object literal · @element options must be named literal assignments · @element options support only root, delegatesFocus and formAssociated · @element requires a string tag name plus an optional options object · @element root "…" is unsupported; use "light", "shadow-open" or "shadow-closed" · @element root must be a string literal · @element tag "…" is not a custom-element name · @element … must be a boolean literal

internal/compiler/semantic-core/analyze-module.ts:778 · internal/compiler/semantic-core/analyze-module.ts:784 · internal/compiler/semantic-core/analyze-module.ts:798 · internal/compiler/semantic-core/analyze-module.ts:803 · internal/compiler/semantic-core/analyze-module.ts:807 · internal/compiler/semantic-core/analyze-module.ts:812 · internal/compiler/semantic-core/analyze-module.ts:818 · internal/compiler/semantic-core/analyze-module.ts:830 · internal/compiler/semantic-core/analyze-module.ts:839
OEC9003编译器语法

compiled classes must be named

2 条不同消息: compiled classes must be named · compiled classes must extend the canonical OpenElement import from '@openelement/element' (found ……)

internal/compiler/semantic-core/analyze-module.ts:858 · internal/compiler/semantic-core/analyze-module.ts:866
OEC9004编译器语法

compiled OpenElement classes must carry exactly one @element decorator

6 条不同消息: compiled OpenElement classes must carry exactly one @element decorator · method parameters may not carry decorators in the compiler grammar · methods may not carry decorators in the compiler grammar · unknown decorator on an OpenElement class; use only @element · unknown decorator on an OpenElement member; use only @property · unknown decorator on an OpenElement member; use only @property imported from '@openelement/element'

internal/compiler/semantic-core/analyze-module.ts:384 · internal/compiler/semantic-core/analyze-module.ts:399 · internal/compiler/semantic-core/analyze-module.ts:554 · internal/compiler/semantic-core/analyze-module.ts:559 · internal/compiler/semantic-core/analyze-module.ts:741 · internal/compiler/semantic-core/analyze-module.ts:769
OEC9005编译器语法

@property reflect must be a boolean literal

9 条不同消息: @property reflect must be a boolean literal · @property requires one options object literal · compiled @property fields must be ordinary initialized instance fields · compiled classes may declare static styles only once · compiled fields must carry exactly one @property decorator · compiled fields require a literal initializer · duplicate property "…" · property names must be identifiers · static styles requires an initializer

internal/compiler/semantic-core/analyze-module.ts:338 · internal/compiler/semantic-core/analyze-module.ts:341 · internal/compiler/semantic-core/analyze-module.ts:371 · internal/compiler/semantic-core/analyze-module.ts:377 · internal/compiler/semantic-core/analyze-module.ts:405 · internal/compiler/semantic-core/analyze-module.ts:408 · internal/compiler/semantic-core/analyze-module.ts:412 · internal/compiler/semantic-core/analyze-module.ts:435 · internal/compiler/semantic-core/analyze-module.ts:458
OEC9006编译器语法

compiled @element classes must be exported (optionally as the default export) without other class modifiers

4 条不同消息: compiled @element classes must be exported (optionally as the default export) without other class modifiers · compiled methods must be concrete instance methods · constructors, accessors and undecorated fields are outside the compiler grammar · method names must be identifiers

internal/compiler/semantic-core/analyze-module.ts:551 · internal/compiler/semantic-core/analyze-module.ts:564 · internal/compiler/semantic-core/analyze-module.ts:584 · internal/compiler/semantic-core/analyze-module.ts:758
OEC9007编译器语法

compiled classes may declare only one render() method

6 条不同消息: compiled classes may declare only one render() method · compiled classes must declare render() · render() must be a single return of one JSX element · render() must be a synchronous zero-argument method · render() must return a single JSX element · render() must return one intrinsic JSX element

internal/compiler/semantic-core/analyze-module.ts:568 · internal/compiler/semantic-core/analyze-module.ts:574 · internal/compiler/semantic-core/analyze-module.ts:588 · internal/compiler/semantic-core/compile.ts:93 · internal/compiler/semantic-core/compile.ts:98 · internal/compiler/semantic-core/lower-program.ts:335
OEC9008编译器语法

runtime top-level statements are outside the compiled module grammar

internal/compiler/semantic-core/analyze-module.ts:701
OEC9010编译器语法

component tag <…> is outside the compiler grammar (intrinsic lowercase elements and custom-element hosts only)

4 条不同消息: component tag <…> is outside the compiler grammar (intrinsic lowercase elements and custom-element hosts only) · itemTagReason · list Region item must be an intrinsic lowercase element · tagReason

internal/compiler/semantic-core/lower-program.ts:363 · internal/compiler/semantic-core/lower-program.ts:368 · internal/compiler/semantic-core/lower-program.ts:945 · internal/compiler/semantic-core/lower-program.ts:948
OEC9011编译器语法

attribute name "…" is unsafe

14 条不同消息: attribute "…" must be a literal or a supported expression · attribute "…" must be a literal, this.<property>, or a supported expression · attribute "…" only accepts primitive literal values · attribute name "…" is unsafe · duplicate attribute "…" is unsupported · item template attribute "…" must be a static literal or {….<field>} · item template attributes must be static literals · item template attributes must use primitive literals · key is only supported on the list Region item root · list Region items do not support spread attributes · property sink name "…" is unsafe · ref must reference this.<field> · spread attributes are not supported by the compiler grammar · spread attributes are not supported in item templates

internal/compiler/semantic-core/lower-program.ts:386 · internal/compiler/semantic-core/lower-program.ts:400 · internal/compiler/semantic-core/lower-program.ts:414 · internal/compiler/semantic-core/lower-program.ts:418 · internal/compiler/semantic-core/lower-program.ts:432 · internal/compiler/semantic-core/lower-program.ts:448 · internal/compiler/semantic-core/lower-program.ts:477 · internal/compiler/semantic-core/lower-program.ts:489 · internal/compiler/semantic-core/lower-program.ts:495 · internal/compiler/semantic-core/lower-program.ts:725 · internal/compiler/semantic-core/lower-program.ts:732 · internal/compiler/semantic-core/lower-program.ts:738 · internal/compiler/semantic-core/lower-program.ts:876 · internal/compiler/semantic-core/lower-program.ts:955 · internal/compiler/semantic-core/lower-program.ts:960 · internal/compiler/semantic-core/lower-program.ts:965 · internal/compiler/semantic-core/lower-program.ts:969 · internal/compiler/semantic-core/lower-program.ts:981 · internal/compiler/semantic-core/lower-program.ts:1001 · internal/compiler/semantic-core/lower-program.ts:1007
OEC9012编译器语法

Region branches must be fully static

3 条不同消息: Region branches must be fully static · conditional Region branches must be single static JSX elements · nested Regions are outside the compiler grammar

internal/compiler/semantic-core/lower-program.ts:438 · internal/compiler/semantic-core/lower-program.ts:446 · internal/compiler/semantic-core/lower-program.ts:454 · internal/compiler/semantic-core/lower-program.ts:752 · internal/compiler/semantic-core/lower-program.ts:767 · internal/compiler/semantic-core/lower-program.ts:781 · internal/compiler/semantic-core/lower-program.ts:842
OEC9013编译器语法

list Region mapper must return one JSX element

12 条不同消息: JSX fragments and spreads are outside the compiler grammar · conditional Regions support this.<property> compared with a numeric literal (>, >=, <, <=), a number/string/boolean equality (===, !==), or a bare this.<property> (optionally negated) truthiness test · dynamic child literals must be primitive values · item child must be {….<field>} · item templates support static text, item values and intrinsic elements · list Region items must bind at least one {<item>.<field>} value or attribute slot · list Region mapper must be a single-parameter arrow function · list Region mapper must return one JSX element · list Regions must map over this.<property> · list Regions support exactly this.<property>.map(...) · unsupported dynamic expression; use this.<property>, a supported condition, or this.<array>.map(...) · void element <…> may not have children

internal/compiler/semantic-core/lower-program.ts:555 · internal/compiler/semantic-core/lower-program.ts:560 · internal/compiler/semantic-core/lower-program.ts:760 · internal/compiler/semantic-core/lower-program.ts:787 · internal/compiler/semantic-core/lower-program.ts:821 · internal/compiler/semantic-core/lower-program.ts:852 · internal/compiler/semantic-core/lower-program.ts:855 · internal/compiler/semantic-core/lower-program.ts:862 · internal/compiler/semantic-core/lower-program.ts:865 · internal/compiler/semantic-core/lower-program.ts:869 · internal/compiler/semantic-core/lower-program.ts:907 · internal/compiler/semantic-core/lower-program.ts:1016 · internal/compiler/semantic-core/lower-program.ts:1044 · internal/compiler/semantic-core/lower-program.ts:1052
OEC9014编译器语法

key must be key={<item>.<field>}

4 条不同消息: key must be key={<item>.<field>} · key must reference ….<field> · list Region items may declare key only once · list Region items require key={<item>.<field>}

internal/compiler/semantic-core/lower-program.ts:879 · internal/compiler/semantic-core/lower-program.ts:885 · internal/compiler/semantic-core/lower-program.ts:896 · internal/compiler/semantic-core/lower-program.ts:899
OEC9015编译器语法

… part path […] is preceded by a dynamic anchor; path-addressed fixed sinks must appear before any dynamic anchor sibling

internal/compiler/semantic-core/emit-program.ts:39
OEC9016编译器语法

event arithmetic supports only numeric += or -= literals

6 条不同消息: event arithmetic supports only numeric += or -= literals · event arrow handlers must contain exactly one supported action · event assignment values must be serializable literals · event handlers must be this.<method> or a single-action arrow · event mutations support only this.<number>++ or -- · unsupported event action; use this.<field>++, assignment or this.<method>()

internal/compiler/semantic-core/lower-program.ts:597 · internal/compiler/semantic-core/lower-program.ts:609 · internal/compiler/semantic-core/lower-program.ts:640 · internal/compiler/semantic-core/lower-program.ts:652 · internal/compiler/semantic-core/lower-program.ts:669 · internal/compiler/semantic-core/lower-program.ts:677
OEC9017编译器语法

custom-element host <…> may not carry a ref

3 条不同消息: custom-element host <…> may not carry a ref · custom-element host <…> may not carry event handlers · custom-element host <…> may not have children in the compiler grammar (slots are unsupported)

internal/compiler/semantic-core/lower-program.ts:397 · internal/compiler/semantic-core/lower-program.ts:444 · internal/compiler/semantic-core/lower-program.ts:1021
OEC9020编译器语法

property defaults must be serializable literals

internal/compiler/semantic-core/analyze-module.ts:431
OEC9021编译器语法

property type/converter must be one of String, Number, Boolean, Array or Object

internal/compiler/semantic-core/analyze-module.ts:165
OEC9022编译器语法

@property option "…" may appear only once

3 条不同消息: @property option "…" may appear only once · @property options must be named literal assignments · unsupported @property option "…"

internal/compiler/semantic-core/analyze-module.ts:446 · internal/compiler/semantic-core/analyze-module.ts:450 · internal/compiler/semantic-core/analyze-module.ts:482
OEC9023编译器语法

a property with attribute: false cannot reflect

4 条不同消息: a property with attribute: false cannot reflect · duplicate property attribute "…" · property attribute must be a string literal or false · property attribute name is unsafe

internal/compiler/semantic-core/analyze-module.ts:469 · internal/compiler/semantic-core/analyze-module.ts:472 · internal/compiler/semantic-core/analyze-module.ts:509 · internal/compiler/semantic-core/analyze-module.ts:514
OEC9024编译器语法

computed field arrows may not declare parameters

9 条不同消息: computed field arrows may not declare parameters · computed field arrows may not nest non-arrow functions · computed field arrows may only reference this.<property> · computed field arrows use an expression body, not a block · computed field arrows use an expression body, not a block (keep derived values atomic) · computed field may not read computed field "…" · computed fields may only read this.<declared property> (found this.…) · computed fields take exactly one zero-argument arrow function · event actions may not write computed field "…" — assign its source properties

internal/compiler/semantic-core/analyze-module.ts:209 · internal/compiler/semantic-core/analyze-module.ts:213 · internal/compiler/semantic-core/analyze-module.ts:224 · internal/compiler/semantic-core/analyze-module.ts:228 · internal/compiler/semantic-core/analyze-module.ts:235 · internal/compiler/semantic-core/analyze-module.ts:240 · internal/compiler/semantic-core/analyze-module.ts:245 · internal/compiler/semantic-core/analyze-module.ts:254 · internal/compiler/semantic-core/lower-program.ts:628
OEC9025编译器语法

computed fields require @property({ reflect: false, attribute: false }) — derived signals have no attribute channel

2 条不同消息: computed fields require @property({ reflect: false, attribute: false }) — derived signals have no attribute channel · computed fields require the canonical computed import: a runtime named import of computed from '@openelement/element'…

internal/compiler/semantic-core/analyze-module.ts:200 · internal/compiler/semantic-core/analyze-module.ts:500
OEC9026编译器语法

an innerHTML sink target must be otherwise childless (the sink owns its content)

8 条不同消息: an innerHTML sink target must be otherwise childless (the sink owns its content) · innerHTML sinks require an Object-typed TrustedHtml property · innerHTML sinks require the explicit trustedHtml capability marker · trustedHtml capability marker must be the literal true · trustedHtml capability marker requires an innerHTML sink · trustedHtml field defaults require the canonical trustedHtml import: a runtime named import of trustedHtml from '@openelement/element'… · trustedHtml field defaults require type: Object, reflect: false, and attribute: false · void element <…> cannot carry an innerHTML sink

internal/compiler/semantic-core/analyze-module.ts:128 · internal/compiler/semantic-core/analyze-module.ts:491 · internal/compiler/semantic-core/lower-program.ts:381 · internal/compiler/semantic-core/lower-program.ts:508 · internal/compiler/semantic-core/lower-program.ts:517 · internal/compiler/semantic-core/lower-program.ts:706 · internal/compiler/semantic-core/lower-program.ts:713 · internal/compiler/semantic-core/lower-program.ts:718
OEC9027编译器语法

unsupported @element provenance: …

2 条不同消息: unsupported @element provenance: … · unsupported @property provenance: …

internal/compiler/semantic-core/analyze-module.ts:393 · internal/compiler/semantic-core/analyze-module.ts:725
BOUNDARY_CAUGHT运行时

BOUNDARY_CAUGHT
SSR_RENDER_ERROR运行时

SSR_RENDER_ERROR
UNKNOWN运行时

UNKNOWN

摘要取该码触发次数最多的消息;调用点消息不唯一时会展开完整列表。源码路径均为仓库相对路径。

由 pnpm --dir www run check:error-codes 从诊断生成,因此新码无法不登记,退役的码也无法留在表上。