@@ -12,6 +12,7 @@ import {
12
12
DiagnosticMessage ,
13
13
Diagnostics ,
14
14
forEach ,
15
+ getSpellingSuggestion ,
15
16
identity ,
16
17
JSDocSyntaxKind ,
17
18
JsxTokenSyntaxKind ,
@@ -3302,6 +3303,10 @@ export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean
3302
3303
}
3303
3304
else if ( propertyName === undefined ) {
3304
3305
error ( Diagnostics . Unknown_Unicode_property_name , propertyNameOrValueStart , pos - propertyNameOrValueStart ) ;
3306
+ const suggestion = getSpellingSuggestion ( propertyNameOrValue , nonBinaryUnicodeProperties . keys ( ) , identity ) ;
3307
+ if ( suggestion ) {
3308
+ error ( Diagnostics . Did_you_mean_0 , propertyNameOrValueStart , pos - propertyNameOrValueStart , suggestion ) ;
3309
+ }
3305
3310
}
3306
3311
pos ++ ;
3307
3312
const propertyValueStart = pos ;
@@ -3311,6 +3316,10 @@ export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean
3311
3316
}
3312
3317
else if ( propertyName !== undefined && ! valuesOfNonBinaryUnicodeProperties [ propertyName ] . has ( propertyValue ) ) {
3313
3318
error ( Diagnostics . Unknown_Unicode_property_value , propertyValueStart , pos - propertyValueStart ) ;
3319
+ const suggestion = getSpellingSuggestion ( propertyValue , valuesOfNonBinaryUnicodeProperties [ propertyName ] , identity ) ;
3320
+ if ( suggestion ) {
3321
+ error ( Diagnostics . Did_you_mean_0 , propertyValueStart , pos - propertyValueStart , suggestion ) ;
3322
+ }
3314
3323
}
3315
3324
}
3316
3325
else {
@@ -3330,6 +3339,10 @@ export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean
3330
3339
}
3331
3340
else if ( ! valuesOfNonBinaryUnicodeProperties . General_Category . has ( propertyNameOrValue ) && ! binaryUnicodeProperties . has ( propertyNameOrValue ) ) {
3332
3341
error ( Diagnostics . Unknown_Unicode_property_name_or_value , propertyNameOrValueStart , pos - propertyNameOrValueStart ) ;
3342
+ const suggestion = getSpellingSuggestion ( propertyNameOrValue , [ ...valuesOfNonBinaryUnicodeProperties . General_Category , ...binaryUnicodeProperties , ...binaryUnicodePropertiesOfStrings ] , identity ) ;
3343
+ if ( suggestion ) {
3344
+ error ( Diagnostics . Did_you_mean_0 , propertyNameOrValueStart , pos - propertyNameOrValueStart , suggestion ) ;
3345
+ }
3333
3346
}
3334
3347
}
3335
3348
scanExpectedChar ( CharacterCodes . closeBrace ) ;
0 commit comments