Skip to content

Commit

Permalink
improve descriptions for ts-expect-error, #139
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Apr 25, 2023
1 parent ed11efa commit 098e381
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions js/linegame/view/ChallengeGraphNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ export default class ChallengeGraphNode extends GraphNode {
this.answerPointNode.translation = challenge.modelViewTransform.modelToViewXY( challenge.answer.x1, challenge.answer.y1 );

// guess
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
this.guessLineNode = new LineNode( challenge.guessProperty, challenge.graph, challenge.modelViewTransform );
this.guessPointNode = new PlottedPointNode( pointRadius, LineGameConstants.GUESS_COLOR );

// optional slope tool
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
this.slopeToolNode = ( options.slopeToolEnabled ) ? new SlopeToolNode( challenge.guessProperty, challenge.modelViewTransform ) : null;

// Rendering order: lines behind points, guess behind answer
Expand Down
8 changes: 4 additions & 4 deletions js/linegame/view/GraphPointSlopeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ export default class GraphPointSlopeNode extends ChallengeGraphNode {
const pointSlopeParameterRange = new PointSlopeParameterRange();
const x1RangeProperty = new Property( challenge.graph.xRange );
const y1RangeProperty = new Property( challenge.graph.yRange );
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const riseRangeProperty = new Property( pointSlopeParameterRange.rise( challenge.guessProperty.value, challenge.graph ) );
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const runRangeProperty = new Property( pointSlopeParameterRange.run( challenge.guessProperty.value, challenge.graph ) );

const manipulatorRadius = challenge.modelViewTransform.modelToViewDeltaX( LineGameConstants.MANIPULATOR_RADIUS );

// point manipulator
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const pointManipulator = new X1Y1Manipulator( manipulatorRadius, challenge.guessProperty, x1RangeProperty, y1RangeProperty, challenge.modelViewTransform, true /* constantSlope */ );
const pointIsVariable = ( challenge.manipulationMode === ManipulationMode.POINT || challenge.manipulationMode === ManipulationMode.POINT_SLOPE );
if ( pointIsVariable ) {
this.addChild( pointManipulator );
}

// slope manipulator
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const slopeManipulator = new SlopeManipulator( manipulatorRadius, challenge.guessProperty, riseRangeProperty, runRangeProperty, challenge.modelViewTransform );
const slopeIsVariable = ( challenge.manipulationMode === ManipulationMode.SLOPE || challenge.manipulationMode === ManipulationMode.POINT_SLOPE );
if ( slopeIsVariable ) {
Expand Down
8 changes: 4 additions & 4 deletions js/linegame/view/GraphSlopeInterceptNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ export default class GraphSlopeInterceptNode extends ChallengeGraphNode {

// dynamic ranges
const parameterRange = new SlopeInterceptParameterRange();
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const riseRangeProperty = new Property( parameterRange.rise( challenge.guessProperty.value, challenge.graph ) );
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const runRangeProperty = new Property( parameterRange.run( challenge.guessProperty.value, challenge.graph ) );
const y1RangeProperty = new Property( challenge.graph.yRange );

const manipulatorRadius = challenge.modelViewTransform.modelToViewDeltaX( LineGameConstants.MANIPULATOR_RADIUS );

// intercept manipulator
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const yInterceptManipulator = new YInterceptManipulator( manipulatorRadius, challenge.guessProperty, y1RangeProperty, challenge.modelViewTransform );
const interceptIsVariable = ( challenge.manipulationMode === ManipulationMode.INTERCEPT || challenge.manipulationMode === ManipulationMode.SLOPE_INTERCEPT );
if ( interceptIsVariable ) {
this.addChild( yInterceptManipulator );
}

// slope manipulator
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const slopeManipulator = new SlopeManipulator( manipulatorRadius, challenge.guessProperty, riseRangeProperty, runRangeProperty, challenge.modelViewTransform );
const slopeIsVariable = ( challenge.manipulationMode === ManipulationMode.SLOPE || challenge.manipulationMode === ManipulationMode.SLOPE_INTERCEPT );
if ( slopeIsVariable ) {
Expand Down
4 changes: 2 additions & 2 deletions js/linegame/view/GraphTwoPointsNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export default class GraphTwoPointsNode extends ChallengeGraphNode {

const manipulatorRadius = challenge.modelViewTransform.modelToViewDeltaX( LineGameConstants.MANIPULATOR_RADIUS );

// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const x1y1Manipulator = new X1Y1Manipulator( manipulatorRadius, challenge.guessProperty,
new Property( challenge.graph.xRange ), new Property( challenge.graph.yRange ), challenge.modelViewTransform, false /* constantSlope */ );

// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const x2y2Manipulator = new X2Y2Manipulator( manipulatorRadius, challenge.guessProperty,
new Property( challenge.graph.xRange ), new Property( challenge.graph.yRange ), challenge.modelViewTransform );

Expand Down
4 changes: 2 additions & 2 deletions js/linegame/view/MakeTheEquationNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export default class MakeTheEquationNode extends ChallengeNode {
answerBoxNode.visible = false;

// Guess
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const guessColor: Color | string = challenge.guessProperty.value.color;
// @ts-expect-error Property<Line | NotALine>
// @ts-expect-error guessProperty is Property<Line | NotALine>
const guessEquationNode = createInteractiveEquationNode( challenge.equationForm, challenge.manipulationMode, challenge.guessProperty, challenge.graph,
GLConstants.INTERACTIVE_EQUATION_FONT_SIZE, guessColor );
const guessBoxNode = new EquationBoxNode( GraphingLinesStrings.yourEquation, guessColor, boxSize, guessEquationNode );
Expand Down

0 comments on commit 098e381

Please sign in to comment.