Skip to content

Commit

Permalink
Use ts-expect-error instead of ts-ignore, see phetsims/chipper#1363
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Dec 7, 2022
1 parent 4bad609 commit 3d11438
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 13 deletions.
2 changes: 0 additions & 2 deletions js/Announcer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ abstract class Announcer extends PhetioObject {
}

public static AnnouncerIO = new IOType( 'AnnouncerIO', {

// @ts-ignore https://github.com/phetsims/tandem/issues/261
valueType: Announcer,
documentation: 'Announces text to a specific browser technology (like aria-live or web speech)'
} );
Expand Down
2 changes: 0 additions & 2 deletions js/ResponsePacket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ class ResponsePacket {

// Map VoicingResponse -> ResolvedResponse (resolve functions and Properties to their values)
public static getResponseText( response: VoicingResponse ): ResolvedResponse {

// @ts-ignore This maps to ensuring we cover the TReadOnlyProperty case, but not in a type safe way, https://github.com/phetsims/scenery/issues/1442
return response instanceof ReadOnlyProperty || response instanceof TinyProperty ? response.value :
typeof response === 'function' ? response() : response;
}
Expand Down
2 changes: 1 addition & 1 deletion js/ResponsePatternCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ResponsePatternCollection {
// TODO: Not sure how to get rid of this index signature error. I was looking at assertion signatures in links below, see https://github.com/phetsims/tambo/issues/160
// https://stackoverflow.com/questions/56568423/typescript-no-index-signature-with-a-parameter-of-type-string-was-found-on-ty
// https://www.carlrippon.com/typescript-assertion-signatures/
// @ts-ignore
// @ts-expect-error
const patternString = this[ key ];
assert && assert( patternString, `no pattern string found for key ${key}` );
return patternString;
Expand Down
6 changes: 3 additions & 3 deletions js/SpeechSynthesisParentPolyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const SpeechSynthesisParentPolyfill = {

assert && assert( window.parent, 'This polyfill requires a parent frame implementation of SpeechSynthesis.' );

// @ts-ignore - Don't judge me TypeScript...
// @ts-expect-error - Don't judge me TypeScript...
window.SpeechSynthesis = window.parent.SpeechSynthesis;

// @ts-ignore - Don't judge me TypeScript...
// @ts-expect-error - Don't judge me TypeScript...
window.speechSynthesis = new window.parent.SpeechSynthesis();

// @ts-ignore - Don't judge me TypeScript...
// @ts-expect-error - Don't judge me TypeScript...
window.SpeechSynthesisUtterance = window.parent.SpeechSynthesisUtterance;
}
};
Expand Down
2 changes: 1 addition & 1 deletion js/Utterance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ class Utterance extends Disposable implements FeatureSpecificAnnouncingControlPr
alert = alertable.value;
}
else {
// @ts-ignore
// @ts-expect-error
alert = alertable;
}
return alert;
Expand Down
2 changes: 1 addition & 1 deletion js/UtteranceQueueTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const VOICING_UTTERANCE_INTERVAL = 125;
// When we want to add a little time to make that an interval has completed.
const TIMING_BUFFER = VOICING_UTTERANCE_INTERVAL + 50;

// @ts-ignore we don't want to expose the constructor of this singleton just for unit tests.
// @ts-expect-error we don't want to expose the constructor of this singleton just for unit tests.
const testVoicingManager = new voicingManager.constructor();
const testVoicingUtteranceQueue = new UtteranceQueue( testVoicingManager );

Expand Down
6 changes: 3 additions & 3 deletions js/utterance-queue-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import utteranceQueue from './main.js'; // eslint-disable-line default-import-ma
( function() {


// @ts-ignore
// @ts-expect-error
window.axon = axon;

// @ts-ignore
// @ts-expect-error
window.phetCore = phetCore;

// @ts-ignore
// @ts-expect-error
window.utteranceQueue = utteranceQueue;
} );

0 comments on commit 3d11438

Please sign in to comment.