Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/oxc_semantic/src/checker/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ pub fn check_array_pattern<'a>(pattern: &ArrayPattern<'a>, ctx: &SemanticBuilder
}

fn not_allowed_namespace_declaration(span: Span) -> OxcDiagnostic {
OxcDiagnostic::error(
ts_error(
"1235",
"A namespace declaration is only allowed at the top level of a namespace or module.",
)
.with_label(span)
Expand Down
40 changes: 20 additions & 20 deletions tasks/coverage/snapshots/parser_typescript.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8186,15 +8186,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc
25 │ member2 = 42;
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext.ts:2:5]
1 │ {
2 │ namespace M { }
· ───────────────
3 │ export namespace N {
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext.ts:3:12]
2 │ namespace M { }
3 │ ╭─▶ export namespace N {
Expand All @@ -8203,15 +8203,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc
6 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext.ts:7:5]
6 │
7 │ namespace Q.K { }
· ─────────────────
8 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext.ts:9:5]
8 │
9 │ ╭─▶ declare module "ambient" {
Expand All @@ -8220,23 +8220,23 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc
12 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext2.ts:2:5]
1 │ function blah () {
2 │ namespace M { }
· ───────────────
3 │ export namespace N {
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext2.ts:2:5]
1 │ function blah () {
2 │ namespace M { }
· ───────────────
3 │ export namespace N {
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext2.ts:3:12]
2 │ namespace M { }
3 │ ╭─▶ export namespace N {
Expand All @@ -8245,7 +8245,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc
6 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext2.ts:3:12]
2 │ namespace M { }
3 │ ╭─▶ export namespace N {
Expand All @@ -8254,23 +8254,23 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc
6 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext2.ts:7:5]
6 │
7 │ namespace Q.K { }
· ─────────────────
8 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext2.ts:7:5]
6 │
7 │ namespace Q.K { }
· ─────────────────
8 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext2.ts:9:5]
8 │
9 │ ╭─▶ declare module "ambient" {
Expand All @@ -8279,7 +8279,7 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc
12 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext2.ts:9:5]
8 │
9 │ ╭─▶ declare module "ambient" {
Expand All @@ -8288,15 +8288,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc
12 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext3.ts:3:9]
2 │ {
3 │ namespace M { }
· ───────────────
4 │ export namespace N {
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext3.ts:4:16]
3 │ namespace M { }
4 │ ╭─▶ export namespace N {
Expand All @@ -8305,15 +8305,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc
7 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext3.ts:8:9]
7 │
8 │ namespace Q.K { }
· ─────────────────
9 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/moduleElementsInWrongContext3.ts:10:9]
9 │
10 │ ╭─▶ declare module "ambient" {
Expand Down Expand Up @@ -12176,15 +12176,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc
2 │ type U2 = string | (foo: number) => void
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/unreachableDeclarations.ts:84:2]
83 │
84 │ namespace Baz { export const value = 1234 }
· ───────────────────────────────────────────
85 │ }
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/unreachableDeclarations.ts:84:2]
83 │
84 │ namespace Baz { export const value = 1234 }
Expand Down Expand Up @@ -12289,15 +12289,15 @@ Expect to Parse: tasks/coverage/typescript/tests/cases/conformance/parser/ecmasc
4 │ bing = true; // no error
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/withStatementErrors.ts:15:5]
14 │
15 │ namespace M {} // error
· ──────────────
16 │
╰────

× A namespace declaration is only allowed at the top level of a namespace or module.
× TS(1235): A namespace declaration is only allowed at the top level of a namespace or module.
╭─[typescript/tests/cases/compiler/withStatementErrors.ts:15:5]
14 │
15 │ namespace M {} // error
Expand Down
Loading