-
-
Notifications
You must be signed in to change notification settings - Fork 725
add potential fix to JsPsychExtension not having version field issue #3565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add potential fix to JsPsychExtension not having version field issue #3565
Conversation
|
|
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! |
There was a problem hiding this 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.
No description provided.