File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed
Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -200,18 +200,16 @@ function main(): void {
200200 for ( const error of currentDictionary . errors ) {
201201 const element = document . createElement ( "li" ) ;
202202 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+ } ) ;
215213 customDictionaryErrorList . appendChild ( element ) ;
216214 }
217215 }
You can’t perform that action at this time.
0 commit comments