File tree 1 file changed +10
-12
lines changed
1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -200,18 +200,16 @@ function main(): void {
200
200
for ( const error of currentDictionary . errors ) {
201
201
const element = document . createElement ( "li" ) ;
202
202
element . innerText = error . message ;
203
- if ( error instanceof PositionedError && error . position != null ) {
204
- const { position, length } = error . position ;
205
- element . addEventListener ( "click" , ( ) => {
206
- customDictionaryTextBox . focus ( ) ;
207
- customDictionaryTextBox . setSelectionRange (
208
- position ,
209
- position + length ,
210
- ) ;
211
- } ) ;
212
- } else {
213
- throw new Error ( "error without position" ) ;
214
- }
203
+ const { position : { position, length } } = error as PositionedError & {
204
+ position : { position : number ; length : number } ;
205
+ } ;
206
+ element . addEventListener ( "click" , ( ) => {
207
+ customDictionaryTextBox . focus ( ) ;
208
+ customDictionaryTextBox . setSelectionRange (
209
+ position ,
210
+ position + length ,
211
+ ) ;
212
+ } ) ;
215
213
customDictionaryErrorList . appendChild ( element ) ;
216
214
}
217
215
}
You can’t perform that action at this time.
0 commit comments