Skip to content

Conversation

@cherriechang
Copy link
Collaborator

No description provided.

@cherriechang cherriechang linked an issue Jul 16, 2025 that may be closed by this pull request
@changeset-bot
Copy link

changeset-bot bot commented Jul 16, 2025

⚠️ No Changeset found

Latest commit: 22bb43a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jodeleeuw
Copy link
Member

This is a good idea -- it seems like extensions should automatically add their version info to the data file on trials where they are active. Like plugins do.

@cherriechang
Copy link
Collaborator Author

This is a good idea -- it seems like extensions should automatically add their version info to the data file on trials where they are active. Like plugins do.

Yay!
Not sure how to check for the fix fixing the issue though. This version still throws errors when running tsc with strict mode on, but this might also be due to reasons outside the scope of this issue?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves type safety for JsPsych extensions by making the info field explicit in type signatures. The changes ensure that extension classes are properly typed with their required metadata, preventing runtime errors when accessing the version field and other extension information.

Key Changes:

  • Added type intersection Class<JsPsychExtension> & { info: JsPsychExtensionInfo } to extension configuration types
  • Replaced bracket notation (type["info"]) with dot notation (type.info) for cleaner, type-safe property access
  • Added fallback handling (?? "") for optional version field

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/jspsych/src/timeline/index.ts Updated TrialExtensionsConfiguration type to include explicit info field requirement and imported JsPsychExtensionInfo
packages/jspsych/src/ExtensionManager.ts Updated all extension class type signatures and replaced bracket notation with dot notation for accessing extension info; added fallback for missing version field
packages/jspsych/src/modules/extensions.ts Added import for Class type from type-fest (note: appears unused)
packages/jspsych/src/timeline/Trial.spec.ts Updated test mocks to include required info field with name and version properties
Comments suppressed due to low confidence (1)

packages/jspsych/src/modules/extensions.ts:1

  • Unused import Class.
import { Class } from "type-fest";

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JsPsychExtension type does not have a version field.

3 participants