@tsrx/content-mapper 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2513,6 +2513,399 @@ const MAPPER_CODES = {
|
|
|
2513
2513
|
/** The project's TSRX configuration is invalid. */
|
|
2514
2514
|
INVALID_CONFIG: /* @__PURE__ */ mapper_code(1003)
|
|
2515
2515
|
};
|
|
2516
|
+
/**
|
|
2517
|
+
* An error TSRX reports: its code, TSRX's own or TypeScript's for a mistake
|
|
2518
|
+
* TypeScript also reports, and its message.
|
|
2519
|
+
* @typedef {{ code: string, message: string }} Diagnostic
|
|
2520
|
+
*/
|
|
2521
|
+
/**
|
|
2522
|
+
* An error whose message takes values, such as a name from the source. Called
|
|
2523
|
+
* with them, it gives the {@link Diagnostic}; its `code` is the code of every
|
|
2524
|
+
* message it gives.
|
|
2525
|
+
* @typedef {((...values: string[]) => Diagnostic) & { code: string }} DiagnosticWithValues
|
|
2526
|
+
*/
|
|
2527
|
+
/**
|
|
2528
|
+
* @param {string} code
|
|
2529
|
+
* @param {(...values: string[]) => string} message
|
|
2530
|
+
* @returns {DiagnosticWithValues}
|
|
2531
|
+
*/
|
|
2532
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2533
|
+
function with_values(code, message) {
|
|
2534
|
+
return Object.assign((...values) => ({
|
|
2535
|
+
code,
|
|
2536
|
+
message: message(...values)
|
|
2537
|
+
}), { code });
|
|
2538
|
+
}
|
|
2539
|
+
/**
|
|
2540
|
+
* The errors TSRX reports for mistakes TypeScript also reports, each with
|
|
2541
|
+
* TypeScript's code for the same mistake. Most have TypeScript's wording too;
|
|
2542
|
+
* the ones in acorn's or acorn-typescript's wording are the upstream errors
|
|
2543
|
+
* TSRX raises itself where it reads the code in their place. A test checks the
|
|
2544
|
+
* wording of each against TypeScript's.
|
|
2545
|
+
*/
|
|
2546
|
+
const TS_ERRORS = {
|
|
2547
|
+
/** `token` is the token expected, such as `}`. */
|
|
2548
|
+
TOKEN_EXPECTED: /* @__PURE__ */ with_values("TS1005", (token) => `'${token}' expected.`),
|
|
2549
|
+
IDENTIFIER_EXPECTED: {
|
|
2550
|
+
code: "TS1003",
|
|
2551
|
+
message: "Identifier expected."
|
|
2552
|
+
},
|
|
2553
|
+
RESERVED_WORD_AS_IDENTIFIER: /* @__PURE__ */ with_values("TS1359", (word) => `Identifier expected. '${word}' is a reserved word that cannot be used here.`),
|
|
2554
|
+
IDENTIFIER_OR_STRING_EXPECTED: {
|
|
2555
|
+
code: "TS1478",
|
|
2556
|
+
message: "Identifier or string literal expected."
|
|
2557
|
+
},
|
|
2558
|
+
CATCH_OR_FINALLY_EXPECTED: {
|
|
2559
|
+
code: "TS1472",
|
|
2560
|
+
message: "'catch' or 'finally' expected."
|
|
2561
|
+
},
|
|
2562
|
+
/** `word` is the word. */
|
|
2563
|
+
STRICT_MODE_RESERVED_WORD: /* @__PURE__ */ with_values("TS1214", (word) => `Identifier expected. '${word}' is a reserved word in strict mode. Modules are automatically in strict mode.`),
|
|
2564
|
+
/** `word` is the word. */
|
|
2565
|
+
STRICT_MODE_RESERVED_WORD_IN_CLASS: /* @__PURE__ */ with_values("TS1213", (word) => `Identifier expected. '${word}' is a reserved word in strict mode. Class definitions are automatically in strict mode.`),
|
|
2566
|
+
LET_DECLARATION_NAME: {
|
|
2567
|
+
code: "TS2480",
|
|
2568
|
+
message: "'let' is not allowed to be used as a name in 'let' or 'const' declarations."
|
|
2569
|
+
},
|
|
2570
|
+
DECLARATION_EXPECTED: {
|
|
2571
|
+
code: "TS1146",
|
|
2572
|
+
message: "Declaration expected."
|
|
2573
|
+
},
|
|
2574
|
+
UNEXPECTED_KEYWORD_OR_IDENTIFIER: {
|
|
2575
|
+
code: "TS1434",
|
|
2576
|
+
message: "Unexpected keyword or identifier."
|
|
2577
|
+
},
|
|
2578
|
+
/** `suggestion` is the keyword, or the keyword and the rest of the name. */
|
|
2579
|
+
UNKNOWN_KEYWORD_OR_IDENTIFIER: /* @__PURE__ */ with_values("TS1435", (suggestion) => `Unknown keyword or identifier. Did you mean '${suggestion}'?`),
|
|
2580
|
+
/** `kind` is `let`, `const`, `using` or `await using`. */
|
|
2581
|
+
BLOCK_SCOPED_DECLARATION_OUTSIDE_BLOCK: /* @__PURE__ */ with_values("TS1156", (kind) => `'${kind}' declarations can only be declared inside a block.`),
|
|
2582
|
+
LABEL_NOT_ALLOWED: {
|
|
2583
|
+
code: "TS1344",
|
|
2584
|
+
message: "'A label is not allowed here."
|
|
2585
|
+
},
|
|
2586
|
+
VARIABLE_DECLARATION_NOT_ALLOWED: {
|
|
2587
|
+
code: "TS1440",
|
|
2588
|
+
message: "Variable declaration not allowed at this location."
|
|
2589
|
+
},
|
|
2590
|
+
EXPRESSION_EXPECTED: {
|
|
2591
|
+
code: "TS1109",
|
|
2592
|
+
message: "Expression expected."
|
|
2593
|
+
},
|
|
2594
|
+
OPTIONAL_CHAIN_TAGGED_TEMPLATE: {
|
|
2595
|
+
code: "TS1358",
|
|
2596
|
+
message: "Tagged template expressions are not permitted in an optional chain."
|
|
2597
|
+
},
|
|
2598
|
+
DECLARATION_OR_STATEMENT_EXPECTED: {
|
|
2599
|
+
code: "TS1128",
|
|
2600
|
+
message: "Declaration or statement expected."
|
|
2601
|
+
},
|
|
2602
|
+
LINE_BREAK_NOT_PERMITTED: {
|
|
2603
|
+
code: "TS1142",
|
|
2604
|
+
message: "Line break not permitted here."
|
|
2605
|
+
},
|
|
2606
|
+
KEYWORD_ESCAPE: {
|
|
2607
|
+
code: "TS1260",
|
|
2608
|
+
message: "Keywords cannot contain escape characters."
|
|
2609
|
+
},
|
|
2610
|
+
JSX_NAME_UNICODE_ESCAPE: {
|
|
2611
|
+
code: "TS17021",
|
|
2612
|
+
message: "Unicode escape sequence cannot appear here."
|
|
2613
|
+
},
|
|
2614
|
+
PRIVATE_IDENTIFIER_OUTSIDE_CLASS: {
|
|
2615
|
+
code: "TS18016",
|
|
2616
|
+
message: "Private identifiers are not allowed outside class bodies."
|
|
2617
|
+
},
|
|
2618
|
+
MODIFIER_ALREADY_SEEN: /* @__PURE__ */ with_values("TS1030", (modifier) => `'${modifier}' modifier already seen.`),
|
|
2619
|
+
MODIFIER_MUST_PRECEDE: /* @__PURE__ */ with_values("TS1029", (modifier, other) => `'${modifier}' modifier must precede '${other}' modifier.`),
|
|
2620
|
+
MODIFIER_CANNOT_BE_USED_WITH: /* @__PURE__ */ with_values("TS1243", (modifier, other) => `'${modifier}' modifier cannot be used with '${other}' modifier.`),
|
|
2621
|
+
MODIFIER_IN_AMBIENT_CONTEXT: /* @__PURE__ */ with_values("TS1040", (modifier) => `'${modifier}' modifier cannot be used in an ambient context.`),
|
|
2622
|
+
MODIFIER_CANNOT_BE_USED_HERE: /* @__PURE__ */ with_values("TS1042", (modifier) => `'${modifier}' modifier cannot be used here.`),
|
|
2623
|
+
MODIFIER_ON_MODULE_ELEMENT: /* @__PURE__ */ with_values("TS1044", (modifier) => `'${modifier}' modifier cannot appear on a module or namespace element.`),
|
|
2624
|
+
MODIFIER_ON_USING: /* @__PURE__ */ with_values("TS1491", (modifier) => `'${modifier}' modifier cannot appear on a 'using' declaration.`),
|
|
2625
|
+
MODIFIER_ON_AWAIT_USING: /* @__PURE__ */ with_values("TS1495", (modifier) => `'${modifier}' modifier cannot appear on an 'await using' declaration.`),
|
|
2626
|
+
MODIFIERS_CANNOT_APPEAR_HERE: {
|
|
2627
|
+
code: "TS1184",
|
|
2628
|
+
message: "Modifiers cannot appear here."
|
|
2629
|
+
},
|
|
2630
|
+
MODIFIER_ON_CONSTRUCTOR: /* @__PURE__ */ with_values("TS1089", (modifier) => `'${modifier}' modifier cannot appear on a constructor declaration.`),
|
|
2631
|
+
ACCESSIBILITY_MODIFIER_ALREADY_SEEN: {
|
|
2632
|
+
code: "TS1028",
|
|
2633
|
+
message: "Accessibility modifier already seen."
|
|
2634
|
+
},
|
|
2635
|
+
READONLY_MODIFIER_NOT_ALLOWED: {
|
|
2636
|
+
code: "TS1024",
|
|
2637
|
+
message: "'readonly' modifier can only appear on a property declaration or index signature."
|
|
2638
|
+
},
|
|
2639
|
+
ACCESSOR_MODIFIER_NOT_ALLOWED: {
|
|
2640
|
+
code: "TS1275",
|
|
2641
|
+
message: "'accessor' modifier can only appear on a property declaration."
|
|
2642
|
+
},
|
|
2643
|
+
ABSTRACT_MODIFIER_NOT_ALLOWED: {
|
|
2644
|
+
code: "TS1242",
|
|
2645
|
+
message: "'abstract' modifier can only appear on a class, method, or property declaration."
|
|
2646
|
+
},
|
|
2647
|
+
DECLARE_MODIFIER_IN_AMBIENT_CONTEXT: {
|
|
2648
|
+
code: "TS1038",
|
|
2649
|
+
message: "A 'declare' modifier cannot be used in an already ambient context."
|
|
2650
|
+
},
|
|
2651
|
+
/** Decorators on a class `static` block. */
|
|
2652
|
+
DECORATORS_NOT_VALID_HERE: {
|
|
2653
|
+
code: "TS1206",
|
|
2654
|
+
message: "Decorators are not valid here."
|
|
2655
|
+
},
|
|
2656
|
+
MODIFIER_ON_IMPORT: /* @__PURE__ */ with_values("TS1079", (modifier) => `A '${modifier}' modifier cannot be used with an import declaration.`),
|
|
2657
|
+
EXPORT_MODIFIER_ON_AUGMENTATION: {
|
|
2658
|
+
code: "TS2668",
|
|
2659
|
+
message: "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible."
|
|
2660
|
+
},
|
|
2661
|
+
READONLY_TYPE_MODIFIER: {
|
|
2662
|
+
code: "TS1354",
|
|
2663
|
+
message: "'readonly' type modifier is only permitted on array and tuple literal types."
|
|
2664
|
+
},
|
|
2665
|
+
NESTED_IMPORT: {
|
|
2666
|
+
code: "TS1232",
|
|
2667
|
+
message: "An import declaration can only be used at the top level of a namespace or module."
|
|
2668
|
+
},
|
|
2669
|
+
NESTED_EXPORT: {
|
|
2670
|
+
code: "TS1233",
|
|
2671
|
+
message: "An export declaration can only be used at the top level of a namespace or module."
|
|
2672
|
+
},
|
|
2673
|
+
NESTED_EXPORT_ASSIGNMENT: {
|
|
2674
|
+
code: "TS1231",
|
|
2675
|
+
message: "An export assignment must be at the top level of a file or module declaration."
|
|
2676
|
+
},
|
|
2677
|
+
NESTED_DEFAULT_EXPORT: {
|
|
2678
|
+
code: "TS1258",
|
|
2679
|
+
message: "A default export must be at the top level of a file or module declaration."
|
|
2680
|
+
},
|
|
2681
|
+
NESTED_NAMESPACE: {
|
|
2682
|
+
code: "TS1235",
|
|
2683
|
+
message: "A namespace declaration is only allowed at the top level of a namespace or module."
|
|
2684
|
+
},
|
|
2685
|
+
NESTED_AMBIENT_MODULE: {
|
|
2686
|
+
code: "TS1234",
|
|
2687
|
+
message: "An ambient module declaration is only allowed at the top level in a file."
|
|
2688
|
+
},
|
|
2689
|
+
NESTED_GLOBAL_EXPORT: {
|
|
2690
|
+
code: "TS1316",
|
|
2691
|
+
message: "Global module exports may only appear at top level."
|
|
2692
|
+
},
|
|
2693
|
+
JUMP_ACROSS_FUNCTION: {
|
|
2694
|
+
code: "TS1107",
|
|
2695
|
+
message: "Jump target cannot cross function boundary."
|
|
2696
|
+
},
|
|
2697
|
+
BREAK_OUTSIDE_LOOP: {
|
|
2698
|
+
code: "TS1105",
|
|
2699
|
+
message: "A 'break' statement can only be used within an enclosing iteration or switch statement."
|
|
2700
|
+
},
|
|
2701
|
+
CONTINUE_OUTSIDE_LOOP: {
|
|
2702
|
+
code: "TS1104",
|
|
2703
|
+
message: "A 'continue' statement can only be used within an enclosing iteration statement."
|
|
2704
|
+
},
|
|
2705
|
+
BREAK_LABEL_NOT_FOUND: {
|
|
2706
|
+
code: "TS1116",
|
|
2707
|
+
message: "A 'break' statement can only jump to a label of an enclosing statement."
|
|
2708
|
+
},
|
|
2709
|
+
CONTINUE_LABEL_NOT_LOOP: {
|
|
2710
|
+
code: "TS1115",
|
|
2711
|
+
message: "A 'continue' statement can only jump to a label of an enclosing iteration statement."
|
|
2712
|
+
},
|
|
2713
|
+
AWAIT_EXPRESSION_NOT_ALLOWED: {
|
|
2714
|
+
code: "TS1308",
|
|
2715
|
+
message: "'await' expressions are only allowed within async functions and at the top levels of modules."
|
|
2716
|
+
},
|
|
2717
|
+
FOR_AWAIT_NOT_ALLOWED: {
|
|
2718
|
+
code: "TS1103",
|
|
2719
|
+
message: "'for await' loops are only allowed within async functions and at the top levels of modules."
|
|
2720
|
+
},
|
|
2721
|
+
AWAIT_USING_NOT_ALLOWED: {
|
|
2722
|
+
code: "TS2852",
|
|
2723
|
+
message: "'await using' statements are only allowed within async functions and at the top levels of modules."
|
|
2724
|
+
},
|
|
2725
|
+
IMPORT_DEFER_DEFAULT: {
|
|
2726
|
+
code: "TS18058",
|
|
2727
|
+
message: "Default imports are not allowed in a deferred import."
|
|
2728
|
+
},
|
|
2729
|
+
IMPORT_DEFER_NAMED: {
|
|
2730
|
+
code: "TS18059",
|
|
2731
|
+
message: "Named imports are not allowed in a deferred import."
|
|
2732
|
+
},
|
|
2733
|
+
IMPORT_SOURCE_BINDING: {
|
|
2734
|
+
code: "TS18111",
|
|
2735
|
+
message: "A source phase import must specify a local binding."
|
|
2736
|
+
},
|
|
2737
|
+
IMPORT_SOURCE_NAMED: {
|
|
2738
|
+
code: "TS18112",
|
|
2739
|
+
message: "Named and namespace imports are not allowed in a source phase import."
|
|
2740
|
+
},
|
|
2741
|
+
/** `name` is the name after `import.`. */
|
|
2742
|
+
IMPORT_META_PROPERTY_CALL: /* @__PURE__ */ with_values("TS18061", (name) => `'${name}' is not a valid meta-property for keyword 'import'. Did you mean 'meta' or 'defer'?`),
|
|
2743
|
+
STRING_LITERAL_EXPECTED: {
|
|
2744
|
+
code: "TS1141",
|
|
2745
|
+
message: "String literal expected."
|
|
2746
|
+
},
|
|
2747
|
+
VARIABLE_DECLARATION_EXPECTED: {
|
|
2748
|
+
code: "TS1134",
|
|
2749
|
+
message: "Variable declaration expected."
|
|
2750
|
+
},
|
|
2751
|
+
VARIABLE_DECLARATION_LIST_EMPTY: {
|
|
2752
|
+
code: "TS1123",
|
|
2753
|
+
message: "Variable declaration list cannot be empty."
|
|
2754
|
+
},
|
|
2755
|
+
/** `kind` is `const`, `using`, or `await using`. */
|
|
2756
|
+
DECLARATION_NOT_INITIALIZED: /* @__PURE__ */ with_values("TS1155", (kind) => `'${kind}' declarations must be initialized.`),
|
|
2757
|
+
FOR_IN_USING: {
|
|
2758
|
+
code: "TS1493",
|
|
2759
|
+
message: "The left-hand side of a 'for...in' statement cannot be a 'using' declaration."
|
|
2760
|
+
},
|
|
2761
|
+
FOR_IN_AWAIT_USING: {
|
|
2762
|
+
code: "TS1494",
|
|
2763
|
+
message: "The left-hand side of a 'for...in' statement cannot be an 'await using' declaration."
|
|
2764
|
+
},
|
|
2765
|
+
BLOCK_SCOPED_VARIABLE_REDECLARED: /* @__PURE__ */ with_values("TS2451", (name) => `Cannot redeclare block-scoped variable '${name}'.`),
|
|
2766
|
+
OUTER_SCOPED_VARIABLE_INITIALIZED: /* @__PURE__ */ with_values("TS2481", (name, declaration) => `Cannot initialize outer scoped variable '${name}' in the same scope as block scoped declaration '${declaration}'.`),
|
|
2767
|
+
CATCH_PARAMETER_REDECLARED: /* @__PURE__ */ with_values("TS2492", (name) => `Cannot redeclare identifier '${name}' in catch clause.`),
|
|
2768
|
+
ENUM_REDECLARED: {
|
|
2769
|
+
code: "TS2567",
|
|
2770
|
+
message: "Enum declarations can only merge with namespace or other enum declarations."
|
|
2771
|
+
},
|
|
2772
|
+
/** `name` is the name, or a string name in its quotes. */
|
|
2773
|
+
DUPLICATE_IDENTIFIER: /* @__PURE__ */ with_values("TS2300", (name) => `Duplicate identifier '${name}'.`),
|
|
2774
|
+
MULTIPLE_DEFAULT_EXPORTS: {
|
|
2775
|
+
code: "TS2528",
|
|
2776
|
+
message: "A module cannot have multiple default exports."
|
|
2777
|
+
},
|
|
2778
|
+
AMBIENT_IMPLEMENTATION: {
|
|
2779
|
+
code: "TS1183",
|
|
2780
|
+
message: "An implementation cannot be declared in ambient contexts."
|
|
2781
|
+
},
|
|
2782
|
+
IMPORT_ALIAS_IMPORT_TYPE: {
|
|
2783
|
+
code: "TS1392",
|
|
2784
|
+
message: "An import alias cannot use 'import type'"
|
|
2785
|
+
},
|
|
2786
|
+
TYPE_IMPORT_DEFAULT_AND_NAMED: {
|
|
2787
|
+
code: "TS1363",
|
|
2788
|
+
message: "A type-only import can specify a default import or named bindings, but not both."
|
|
2789
|
+
},
|
|
2790
|
+
SIGNATURE_PARAMETER_INITIALIZER: {
|
|
2791
|
+
code: "TS2371",
|
|
2792
|
+
message: "A parameter initializer is only allowed in a function or constructor implementation."
|
|
2793
|
+
},
|
|
2794
|
+
PATTERN_PARAMETER_PROPERTY: {
|
|
2795
|
+
code: "TS1187",
|
|
2796
|
+
message: "A parameter property may not be declared using a binding pattern."
|
|
2797
|
+
},
|
|
2798
|
+
REST_PARAMETER_PROPERTY: {
|
|
2799
|
+
code: "TS1317",
|
|
2800
|
+
message: "A parameter property cannot be declared using a rest parameter."
|
|
2801
|
+
},
|
|
2802
|
+
PARAMETER_PROPERTY_OUTSIDE_CONSTRUCTOR: {
|
|
2803
|
+
code: "TS2369",
|
|
2804
|
+
message: "A parameter property is only allowed in a constructor implementation."
|
|
2805
|
+
},
|
|
2806
|
+
REST_PARAMETER_INITIALIZER: {
|
|
2807
|
+
code: "TS1048",
|
|
2808
|
+
message: "A rest parameter cannot have an initializer."
|
|
2809
|
+
},
|
|
2810
|
+
REST_ELEMENT_INITIALIZER: {
|
|
2811
|
+
code: "TS1186",
|
|
2812
|
+
message: "A rest element cannot have an initializer."
|
|
2813
|
+
},
|
|
2814
|
+
OPTIONAL_REST_PARAMETER: {
|
|
2815
|
+
code: "TS1047",
|
|
2816
|
+
message: "A rest parameter cannot be optional."
|
|
2817
|
+
},
|
|
2818
|
+
OPTIONAL_BINDING_PATTERN_PARAMETER: {
|
|
2819
|
+
code: "TS2463",
|
|
2820
|
+
message: "A binding pattern parameter cannot be optional in an implementation signature."
|
|
2821
|
+
},
|
|
2822
|
+
UNEXPECTED_TOKEN: {
|
|
2823
|
+
code: "TS1012",
|
|
2824
|
+
message: "Unexpected token"
|
|
2825
|
+
},
|
|
2826
|
+
REST_PARAMETER_NOT_LAST: {
|
|
2827
|
+
code: "TS1014",
|
|
2828
|
+
message: "A rest parameter must be last in a parameter list."
|
|
2829
|
+
},
|
|
2830
|
+
REST_ELEMENT_NOT_LAST: {
|
|
2831
|
+
code: "TS2462",
|
|
2832
|
+
message: "A rest element must be last in a destructuring pattern."
|
|
2833
|
+
},
|
|
2834
|
+
REST_ELEMENT_TRAILING_COMMA: {
|
|
2835
|
+
code: "TS1013",
|
|
2836
|
+
message: "Comma is not permitted after the rest element"
|
|
2837
|
+
},
|
|
2838
|
+
ARGUMENT_NAME_CLASH: {
|
|
2839
|
+
code: "TS2300",
|
|
2840
|
+
message: "Argument name clash"
|
|
2841
|
+
},
|
|
2842
|
+
KEYWORD_ESCAPE_SEQUENCE: /* @__PURE__ */ with_values("TS1260", (keyword) => `Escape sequence in keyword ${keyword}`),
|
|
2843
|
+
AWAIT_USING_OUTSIDE_ASYNC: {
|
|
2844
|
+
code: "TS2852",
|
|
2845
|
+
message: "Await using cannot appear outside of async function"
|
|
2846
|
+
},
|
|
2847
|
+
FOR_IN_INITIALIZER: {
|
|
2848
|
+
code: "TS1189",
|
|
2849
|
+
message: "for-in loop variable declaration may not have an initializer"
|
|
2850
|
+
},
|
|
2851
|
+
FOR_OF_INITIALIZER: {
|
|
2852
|
+
code: "TS1190",
|
|
2853
|
+
message: "for-of loop variable declaration may not have an initializer"
|
|
2854
|
+
},
|
|
2855
|
+
MISSING_CATCH_OR_FINALLY: {
|
|
2856
|
+
code: "TS1472",
|
|
2857
|
+
message: "Missing catch or finally clause"
|
|
2858
|
+
},
|
|
2859
|
+
MULTIPLE_DEFAULT_CLAUSES: {
|
|
2860
|
+
code: "TS1113",
|
|
2861
|
+
message: "Multiple default clauses"
|
|
2862
|
+
},
|
|
2863
|
+
USE_STRICT_NON_SIMPLE_PARAMETERS: {
|
|
2864
|
+
code: "TS1347",
|
|
2865
|
+
message: "Illegal 'use strict' directive in function with non-simple parameter list"
|
|
2866
|
+
},
|
|
2867
|
+
JSX_UNESCAPED_CLOSING_BRACE: {
|
|
2868
|
+
code: "TS1381",
|
|
2869
|
+
message: "Unexpected token `}`. Did you mean `}` or `{\"}\"}`?"
|
|
2870
|
+
},
|
|
2871
|
+
JSX_ATTRIBUTE_EMPTY_EXPRESSION: {
|
|
2872
|
+
code: "TS17000",
|
|
2873
|
+
message: "JSX attributes must only be assigned a non-empty expression"
|
|
2874
|
+
},
|
|
2875
|
+
JSX_ATTRIBUTE_VALUE: {
|
|
2876
|
+
code: "TS1145",
|
|
2877
|
+
message: "value should be either an expression or a quoted text"
|
|
2878
|
+
},
|
|
2879
|
+
ONLY_STRING_ATTRIBUTE_VALUE: {
|
|
2880
|
+
code: "TS2858",
|
|
2881
|
+
message: "Only string is supported as an attribute value"
|
|
2882
|
+
},
|
|
2883
|
+
TYPE_IMPORT_ARGUMENT: {
|
|
2884
|
+
code: "TS1141",
|
|
2885
|
+
message: "Argument in a type import must be a string literal."
|
|
2886
|
+
},
|
|
2887
|
+
UNEXPECTED_LEADING_DECORATOR: {
|
|
2888
|
+
code: "TS1206",
|
|
2889
|
+
message: "Leading decorators must be attached to a class declaration."
|
|
2890
|
+
},
|
|
2891
|
+
TYPE_CAST_IN_PARAMETER: {
|
|
2892
|
+
code: "TS1005",
|
|
2893
|
+
message: "Unexpected type cast in parameter position."
|
|
2894
|
+
},
|
|
2895
|
+
UNEXPECTED_TYPE_ANNOTATION: {
|
|
2896
|
+
code: "TS1005",
|
|
2897
|
+
message: "Did not expect a type annotation here."
|
|
2898
|
+
},
|
|
2899
|
+
RESERVED_ARROW_TYPE_PARAMETER: {
|
|
2900
|
+
code: "TS7060",
|
|
2901
|
+
message: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`."
|
|
2902
|
+
},
|
|
2903
|
+
/** A type assertion written `<T>x` in a `.mts` or `.cts` file. */
|
|
2904
|
+
RESERVED_TYPE_ASSERTION: {
|
|
2905
|
+
code: "TS7059",
|
|
2906
|
+
message: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."
|
|
2907
|
+
}
|
|
2908
|
+
};
|
|
2516
2909
|
|
|
2517
2910
|
//#endregion
|
|
2518
2911
|
//#region src/diagnostic-directives.js
|
|
@@ -2525,6 +2918,7 @@ const MAPPER_CODES = {
|
|
|
2525
2918
|
* error.
|
|
2526
2919
|
*/
|
|
2527
2920
|
const HOLDER_TYPE = /(?:Statement|Declaration|Definition|Signature)$|^(?:StaticBlock|AccessorProperty|JSXElement|JSXFragment|JSXStyleElement)$/;
|
|
2921
|
+
const JSX_NAME_ESCAPE_CODE = TS_ERRORS.JSX_NAME_UNICODE_ESCAPE.code;
|
|
2528
2922
|
/** Keys of a tree node that hold no child nodes, or nodes that aren't its children. */
|
|
2529
2923
|
const NOT_CHILDREN = /* @__PURE__ */ new Set([
|
|
2530
2924
|
"metadata",
|
|
@@ -2576,7 +2970,7 @@ function ignore_directives(errors, source_ast, mappings, original_length, genera
|
|
|
2576
2970
|
if (typeof error.pos !== "number") continue;
|
|
2577
2971
|
const on_tag = reported_on_tag(error);
|
|
2578
2972
|
const position = on_tag ? error.raisedAt - 1 : error.pos;
|
|
2579
|
-
const holder = source_ast ? holder_at(source_ast, position) : null;
|
|
2973
|
+
const holder = source_ast && error.code !== JSX_NAME_ESCAPE_CODE ? holder_at(source_ast, position) : null;
|
|
2580
2974
|
const start = holder ? holder.start : error.pos;
|
|
2581
2975
|
const end = holder ? holder.end : typeof error.end === "number" && error.end > error.pos ? error.end : error.pos + 1;
|
|
2582
2976
|
const own_code = on_tag && !holder;
|
|
@@ -4019,4 +4413,4 @@ function nearest_package_manifest(entry) {
|
|
|
4019
4413
|
|
|
4020
4414
|
//#endregion
|
|
4021
4415
|
export { validate_options as i, require$1 as n, to_diagnostic as r, create_tsrx_content_mapper as t };
|
|
4022
|
-
//# sourceMappingURL=mapper-
|
|
4416
|
+
//# sourceMappingURL=mapper-CiYVAopk.js.map
|