Skip to content

autodoc: extension param parser misses start parameters #73

Description

@becky-gilbert

I'm using autodoc on an extension package, and it's picking up my initialization parameters, but not my start parameters. I define the initialize and start parameters like this:

interface InitializeParameters {
  /**
   * Whether or not the pause/unpause should be controlled with a keyboard key press.
   * @default true
   */
  allow_key_response?: boolean;
  // ... more parameters ...
}

// Per-trial params are the same set of options as InitializeParameters.
// Any param provided here overrides the global default for that trial only.
type OnStartParameters = InitializeParameters;

class PauseExtension implements JsPsychExtension {
  static info: JsPsychExtensionInfo = {
    name: "extension-pause",
    version: version,
    // ... more static info ... 
  };

  initialize = (params: InitializeParameters): Promise<void> => {
    // ... code ... 
  };

  on_start = (params: OnStartParameters = {}): void => {
    // ... code ... 
  };

And here's the relevant bit of the generated doc:

<!-- jspsych-autodocs:init-parameters:start -->
### Initialization Parameters
Initialization parameters are set when calling `initJsPsych()`.

```js
initJsPsych({
  extensions: {
    { type: jsPsychExtensionExtensionPause, params: { ... } }
  }
})
```

| Parameter | Type | Default Value | Description |
| --------- | ---- | ------------- | ----------- |
| allow_key_response | boolean | `true` | Whether or not the pause/unpause should be controlled with a keyboard key press. |
   ... etc ...
<!-- jspsych-autodocs:init-parameters:end -->

<!-- jspsych-autodocs:trial-parameters:start -->
### Trial Parameters

Trial parameters are set when adding an extension to the trial object.

```js
var trial = {
  type: jsPsych...,
  extensions: [
    { type: jsPsychExtensionExtensionPause, params: { ... } }
  ]
}
```

| Parameter | Type | Default Value | Description |
| --------- | ---- | ------------- | ----------- |
<!-- jspsych-autodocs:trial-parameters:end -->

I'm assuming that my start parameters should be picked up by autodoc - is that right? Or have I done something weird with my start param argument type and/or on_start definition that's causing autodoc to miss it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions