Skip to content

Conversation

@benchristel
Copy link
Member

These type errors appeared intermittently when running tsc --watch. I suspect
there's a cleaner way to deal with these refs. In the short term, suppressing the
errors in code is preferable to tolerating them.

Issue: none

Test plan:

pnpm tsc -w

@github-actions
Copy link
Contributor

Size Change: 0 B

Total Size: 466 kB

ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.7 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 5.98 kB
packages/math-input/dist/es/index.js 98.6 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.js 18.5 kB
packages/perseus-editor/dist/es/index.js 88.4 kB
packages/perseus-linter/dist/es/index.js 7.05 kB
packages/perseus-score/dist/es/index.js 9.04 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/index.js 199 kB
packages/perseus/dist/es/strings.js 7.49 kB
packages/pure-markdown/dist/es/index.js 1.22 kB
packages/simple-markdown/dist/es/index.js 6.71 kB

compressed-size-action

@github-actions
Copy link
Contributor

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (6efc9c1) and published it to npm. You
can install it using the tag PR2433.

Example:

pnpm add @khanacademy/perseus@PR2433

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.js -t PR2433

focus: () => boolean = () => {
this.inputRef.current?.focus();
// TODO(benchristel): type `inputRef` properly.
// Typechecking fails here intermittently, probably because of nondeterminism
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never had trouble with this, is it possibly a local configuration issue? Are other people seeing this? The fact that TS fails it sometimes seems like a red flag to me. Is there a ticket to follow up on this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any special local configuration. Are you running pnpm tsc --watch from the command line? Or something else?

I seem to recall that @SonicScrewdriver was able to repro this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I was a little confused about this one. It was working perfectly fine on my machine, but I believe other people on the team were seeing some errors. It passed the PR checks fine as well, at the time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still seems fine for me right now. (I checked in both VSCode and Cursor in case Cursor isn't set up properly.)

Screenshot 2025-05-07 at 9 49 14 AM

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way that we've defined this ref to bridge between two different components feels wrong to me. I can repro the type check failures by using pnpm tsc --watch and then making a change in this file.

I think what we should do is have the ref defined using an interface with the common functions defined in that interface.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this fix things for you @benchristel

#2452

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2452 has landed. :)

@benchristel
Copy link
Member Author

Superseded by #2452.

@benchristel benchristel closed this May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants