teasel
Search
Search the documentation

Error codes

Every code an error can have and what it means. args holds what the error is about when the code says so, and message is the code followed by each argument in quotes: expected '}'.

code meaning
unexpected_token A token the grammar does not allow here.
expected A token other than the one the grammar needs next; args names what was needed.
unclosed A tag, block or bracket never closed; args names it.
unexpected_close A closing tag, block or bracket with nothing open; args names it.
invalid_name A name a host's grammar cannot take; args names it.
duplicate A thing that may appear once appears again; args names it.
placement A construct in a place the grammar does not allow it; args names it.
unexpected_eof The text ended while a token was still needed; pos is the end of what was parsed.
unexpected_character A character no token starts with; args holds it.
unexpected_keyword A keyword where a name or expression is needed; args names it.
reserved_word A reserved word used as a name; args names it.
escape_in_keyword A keyword spelled with an escape sequence; args names it.
nesting_depth Nesting deeper than the engine's limit.
tree_size A tree larger than the engine's limit.
not_typescript TypeScript syntax in a parse without typescript.
unterminated_comment A comment the text ends inside.
unterminated_string A string the line or text ends inside.
unterminated_template A template the text ends inside.
unterminated_regexp A regular expression the line or text ends inside.
invalid_regexp A regular expression pattern that does not parse; args holds the pattern and the reason.
invalid_regexp_flag A regular expression flag that does not exist.
duplicate_regexp_flag A regular expression flag given twice.
invalid_number A number that does not parse.
expected_number_in_radix A radix prefix with no digits after it; args holds the radix.
identifier_after_number An identifier starting right after a number.
numeric_separator_first A numeric separator before the first digit.
numeric_separator_last A numeric separator after the last digit.
numeric_separator_double Two numeric separators in a row.
numeric_separator_legacy_octal A numeric separator in a legacy octal number.
bad_character_escape An escape sequence that does not parse.
bad_template_escape An escape sequence that does not parse, in a template with no tag.
invalid_unicode_escape A \u escape that does not parse.
expected_unicode_escape A \ in a name with no u after it.
code_point_out_of_bounds A \u{…} escape above the last code point.
strict_with with in strict mode.
strict_delete delete of a name in strict mode.
strict_directive_non_simple_params "use strict" in a function whose parameters are not all plain names.
strict_binding A name strict mode does not allow to be declared or assigned; args names it.
strict_octal A legacy octal number or escape in strict mode.
strict_escape A \8 or \9 escape in strict mode.
let_as_binding let as the name of a let, const, using or class declaration.
redeclaration A name declared again where it cannot be; args names it.
duplicate_label A label already in use; args names it.
duplicate_parameter A parameter name used twice where that is not allowed.
duplicate_proto __proto__ twice in an object literal.
duplicate_default Two default clauses in a switch.
duplicate_export A name exported twice; args names it.
undefined_export An exported name that is not declared; args names it.
string_export_without_from An export of a string name with no from.
lone_surrogate_in_module_name A lone surrogate in a string export name.
duplicate_import_attribute An import attribute key given twice; args names it.
import_export_in_script import or export with sourceType script.
import_export_not_top_level import or export below the top level.
import_meta_outside_module import.meta outside a module.
import_meta_escaped import.meta spelled with an escape sequence.
invalid_import_meta import. followed by something other than meta.
invalid_new_target new. followed by something other than target.
new_target_escaped new.target spelled with an escape sequence.
new_target_outside_function new.target outside a function or class static block.
unsyntactic A break or continue with no loop, switch or label to go to; args names the statement.
return_outside_function return outside a function.
newline_after_throw A line break between throw and its expression.
missing_catch_or_finally A try with neither catch nor finally.
for_in_of_initializer An initializer on the declaration of a for-in or for-of; args names the loop.
for_of_let A for-of whose left side starts with let.
await_as_identifier await as a name inside an async function.
await_outside_async await outside an async function or module.
await_in_default_value await in a parameter's default value.
yield_as_identifier yield as a name inside a generator.
yield_in_default_value yield in a parameter's default value.
invalid_in_static_block await or arguments in a class static block; args names it.
arguments_in_field_initializer arguments in a class field initializer.
invalid_assignment_target An assignment to something that cannot be assigned.
invalid_binding_target A binding to something that cannot be bound.
binding_member_expression A member expression where a binding is needed.
parenthesized_pattern A parenthesized pattern.
binding_parenthesized A parenthesized expression where a binding is needed.
optional_chain_assignment An optional chain assigned to.
optional_chain_in_new An optional chain as the callee of new.
optional_chain_in_tagged_template An optional chain as the tag of a template.
mixed_coalesce ?? mixed with || or && without parentheses.
private_name_outside_in A private name outside the left side of in.
undeclared_private_name A private name no enclosing class declares; args names it.
delete_private delete of a private name.
invalid_super super where neither a call nor a property follows.
super_outside_method super outside a method.
super_call_outside_constructor super() outside the constructor of a derived class.
comma_after_rest A comma after a rest element.
rest_with_default A default value on a rest element.
accessor_in_pattern A getter or setter in an object pattern.
shorthand_assignment A shorthand a = 1 in an object that is not a pattern.
pattern_without_initializer A pattern declared without a value.
using_pattern A pattern in a using declaration; args names the declaration.
using_without_initializer A using declaration without a value; args names the declaration.
using_in_for_in A using declaration as the left side of a for-in; args names the declaration.
using_outside_block A using declaration at the top level of a script or in a case clause; args names the declaration.
invalid_default_operator An operator other than = giving a default value.
getter_params A getter with parameters.
setter_params A setter with other than one parameter.
setter_rest_param A setter with a rest parameter.
generator_constructor A constructor that is a generator.
async_constructor A constructor that is async.
accessor_constructor A constructor that is a getter or setter.
duplicate_constructor Two constructors in a class.
constructor_field A class field named constructor.
private_constructor A class element named #constructor.
static_prototype A static class element named prototype.
abstract_outside_abstract_class An abstract method outside an abstract class.
abstract_with_implementation An abstract method with a body; args names it.
abstract_with_initializer An abstract property with a value; args names it.
duplicate_accessibility Two accessibility modifiers on one element.
duplicate_modifier A modifier given twice; args names it.
conflicting_modifiers Two modifiers that cannot go together; args names both.
modifier_order Two modifiers in the wrong order; args names the one that must come first, then the other.
declare_on_method declare on a method.
readonly_on_method readonly on a method.
readonly_placement readonly on other than a property or index signature.
readonly_type_operand readonly on a type other than an array or tuple.
override_without_extends override in a class that extends nothing.
index_signature_modifier A modifier on an index signature; args names it.
private_modifier A modifier on a private element; args names it.
static_block_modifier A modifier on a static block.
accessor_type_parameters Type parameters on a getter or setter.
constructor_type_parameters Type parameters on a constructor.
setter_return_type A return type on a setter.
decorator_placement A decorator on something other than a class or a class element, or split around export.
decorator_on_constructor A decorator on a constructor.
decorator_without_body A decorator on a method or accessor without a body.
this_parameter_modifiers A decorator or modifier on a this parameter.
optional_with_initializer A parameter both optional and with a default value.
required_after_optional A required parameter or tuple element after an optional one.
optional_rest A rest parameter marked optional.
setter_optional_parameter An optional parameter on a setter.
setter_parameter_initializer A default value on a setter's parameter.
constructor_return_type A return type on a constructor.
constructor_modifier A modifier on a constructor; args names it.
index_signature_type An index signature without a type.
predicate_placement A type predicate outside a return type.
infer_placement infer outside the extends clause of a conditional type.
const_assertion_target as const on other than a literal or a reference.
catch_clause_type A catch clause variable typed other than any or unknown.
abstract_placement abstract on other than a class, method or property.
export_assignment_in_namespace export = in a namespace.
quoted_module_name A quoted module name on a module that is not ambient.
implementation_in_ambient A body in an ambient context.
initializer_in_ambient A value in an ambient context.
ambient_const_initializer An ambient const with a value other than a literal or enum member.
export_declare_without_declaration export declare followed by other than a declaration.
interface_without_name interface followed by other than a name.
type_redeclaration A type declared again; args names it.
import_type_alias import type on an import alias.
type_import_argument A type import of other than a string.
type_import_default_and_named import type with both a default and named imports.
type_modifier_in_type_import type on a name of an import type or export type.
unexpected_type_annotation A type annotation where none can be.
type_annotation_after_default A type annotation after a default value.
empty_type_arguments <> with no type arguments.
empty_type_parameters <> with no type parameters.
empty_list A list that cannot be empty; args names it.
type_member_modifier A modifier on a type member; args names it.
type_parameter_modifier A modifier on a type parameter where it cannot be; args names it.
invalid_const const as a type.
tuple_label A tuple label that is not a plain name.
optional_pattern_parameter An optional pattern parameter in an implementation.
parameter_property_pattern A parameter property declared with a pattern or as a rest.
signature_parameter_default A default value anywhere in a parameter of a signature.
definite_with_initializer A ! definite assignment on a declaration with a value.
generator_in_ambient A generator in an ambient context.
generator_signature An overload signature marked as a generator.
declare_in_ambient declare inside an ambient context.
statement_in_ambient A statement in an ambient context.
using_in_ambient A using declaration in an ambient context; args names the declaration.
invalid_request An offset or option the request cannot take; args says which, no line or column.
property_after_instantiation A property access right after an instantiation expression.
accessor_placement accessor on other than a property.