Skip to content

Conversation

@myabc
Copy link
Contributor

@myabc myabc commented Jan 31, 2026

Please fill in this template.

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes:
    • adds support for Turbo.config object, added in Turbo 8.0.6. Adds deprecation warnings accordingly.
    • adds support for morphing functions, exposed as public API in Turbo 8.0.19.
  • If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the package.json Unfortunately, Turbo doesn't seem to use semantic versioning, introducing breaking API changes in patch versions.
    • Tested with Turbo 8.0.21.
    • Tested with Turbo 8.0.23.

This pull request expands the test coverage for the Turbo TypeScript types, ensuring that more of the public API is exercised and type-checked. The changes include importing additional Turbo modules, adding tests for various Turbo features and configuration options, and verifying correct type inference and error handling.

Expanded Turbo API coverage:

  • Added imports for more Turbo modules, including cache, config, connectStreamSource, disconnectStreamSource, navigator, renderStreamMessage, session, start, StreamMessage, and StreamSource to hotwired__turbo-tests.ts.
  • Added tests for start(), session.adapter methods, navigator.submitForm, and cache methods to verify correct usage and type inference.
  • Added comprehensive tests for config.drive and config.forms, including assignments, type checks, and error scenarios for configuration options.

Stream handling and message rendering:

  • Added tests for stream source connection/disconnection, stream message creation, and rendering, including type checks and error handling.
  • Verified type inference and readonly status of StreamElement.templateElement and templateContent properties.

Copilot AI review requested due to automatic review settings January 31, 2026 23:20
@typescript-bot
Copy link
Contributor

typescript-bot commented Jan 31, 2026

@myabc Thank you for submitting this PR!

This is a live comment that I will keep updated.

1 package in this PR

Code Reviews

Because you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • 🕐 Continuous integration tests are still running
  • 🕐 Most recent commit is approved by type definition owners, DT maintainers or others

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 74439,
  "author": "myabc",
  "headCommitOid": "ba96c855b542ce5fa44d377a2bed7809d43ad53e",
  "mergeBaseOid": "a6d66513a05f41189f993c63eefbf6326b5640a3",
  "lastPushDate": "2026-01-31T23:20:00.000Z",
  "lastActivityDate": "2026-02-02T02:43:46.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Well-liked by everyone",
  "pkgInfo": [
    {
      "name": "hotwired__turbo",
      "kind": "edit",
      "files": [
        {
          "path": "types/hotwired__turbo/hotwired__turbo-tests.ts",
          "kind": "test"
        },
        {
          "path": "types/hotwired__turbo/index.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "G-Rath",
        "lukeify",
        "myabc"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    }
  ],
  "reviews": [
    {
      "type": "stale",
      "reviewer": "G-Rath",
      "date": "2026-02-01T00:57:22.000Z",
      "abbrOid": "2117629"
    }
  ],
  "mainBotCommentID": 3829572796,
  "ciResult": "unknown"
}

@typescript-bot typescript-bot added the Author is Owner The author of this PR is a listed owner of the package. label Jan 31, 2026
@typescript-bot
Copy link
Contributor

🔔 @G-Rath @lukeify — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot typescript-bot moved this to Waiting for Code Reviews in Pull Request Status Board Jan 31, 2026
@DangerBotOSS
Copy link

DangerBotOSS commented Jan 31, 2026

Fails
🚫

Danger failed to run dangerfile.ts.

Error TypeError

Cannot read properties of null (reading 'filename')
TypeError: Cannot read properties of null (reading 'filename')
    at shouldUseGitHubOverride (/home/runner/work/DefinitelyTyped/DefinitelyTyped/node_modules/.pnpm/[email protected][email protected]/node_modules/danger/distribution/platforms/github/customGitHubRequire.js:131:16)
    at _module2.default._load (/home/runner/work/DefinitelyTyped/DefinitelyTyped/node_modules/.pnpm/[email protected]/node_modules/override-require/dist/overrideRequire.js:38:9)
    at node:internal/modules/esm/translators:273:15
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:240:7)
    at ModuleJobSync.runSync (node:internal/modules/esm/module_job:437:37)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:389:47)
    at loadESMFromCJS (node:internal/modules/cjs/loader:1363:24)
    at Module._compile (node:internal/modules/cjs/loader:1503:5)
    at requireFromString (/home/runner/work/DefinitelyTyped/DefinitelyTyped/node_modules/.pnpm/[email protected]/node_modules/require-from-string/index.js:28:4)
    at /home/runner/work/DefinitelyTyped/DefinitelyTyped/node_modules/.pnpm/[email protected][email protected]/node_modules/danger/distribution/runner/runners/inline.js:161:68

Dangerfile

126|     // number of backticks cannot close the block.
127|     const codeBlock = "``````````";
128|     const message = [
129|         "## Formatting errors",
130|         "",
-------------------^
131|         codeBlock,
132|         ...dprintErrors.join("\n\n"),
133|         codeBlock,
134|     ];

Generated by 🚫 dangerJS against ba96c85

Copy link
Contributor

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 pull request enhances the type definitions for the @hotwired/turbo library by adding comprehensive typings for configuration, navigation, caching, and browser adapter functionality.

Changes:

  • Added new interfaces for BrowserAdapter, Navigator, Cache, DriveConfig, FormsConfig, and TurboConfig
  • Exposed additional exports including start(), navigator, cache, config, and session
  • Added templateElement and templateContent properties to StreamElement
  • Added adapter property to TurboSession
  • Added deprecation notices for setProgressBarDelay and setConfirmMethod
  • Added comprehensive test coverage for new functionality

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.

File Description
types/hotwired__turbo/index.d.ts Added 6 new interfaces (BrowserAdapter, Navigator, Cache, DriveConfig, FormsConfig, TurboConfig), 2 new StreamElement properties, 1 new TurboSession property, and 4 new top-level exports with deprecation notices for legacy methods
types/hotwired__turbo/hotwired__turbo-tests.ts Added comprehensive tests for all new exports, properties, and configuration options including type assertions and read-only verifications

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

Add new APIs and types introduced in Turbo 8.0.21:

- StreamElement: add static renderElement(), removeDuplicateTargetSiblings()
- StreamSourceElement: new custom element class
- FormsConfig: add submitter property with SubmitterConfig interface
- New functions: registerAdapter, setFormMode (deprecated), morphElements,
  morphChildren, morphBodyElements, morphTurboFrameElements
- MorphOptions interface for morph function configuration
- New morph events: turbo:morph, turbo:before-morph-element,
  turbo:morph-element, turbo:before-morph-attribute, turbo:before-frame-morph
- TurboGlobal: add StreamActions, stream functions, and morph functions
- TurboElementTagNameMap: add turbo-stream-source element

Tested against OpenProject frontend with Turbo 8.0.23.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@myabc myabc changed the title Flesh out typings for @hotwired/turbo [@hotwired/turbo] Add missing types, update for 8.0.23 Jan 31, 2026
Copy link
Contributor

@G-Rath G-Rath left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

@typescript-bot
Copy link
Contributor

@G-Rath Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot typescript-bot added Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner labels Jan 31, 2026
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Waiting for Author to Merge in Pull Request Status Board Jan 31, 2026
- Fix comment: confirm method defaults to (not replaces) window.confirm
- Add tests for config.drive.enabled assignment
- Add tests for config.drive.unvisitableExtensions Set modification
- Add test for config.forms.confirm assignment

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@typescript-bot typescript-bot removed Self Merge This PR can now be self-merged by the PR author or an owner Owner Approved A listed owner of this package signed off on the pull request. labels Feb 1, 2026
@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Waiting for Code Reviews in Pull Request Status Board Feb 1, 2026
@typescript-bot
Copy link
Contributor

@G-Rath Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot
Copy link
Contributor

@G-Rath Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot typescript-bot added Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner labels Feb 1, 2026
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Waiting for Author to Merge in Pull Request Status Board Feb 1, 2026
@typescript-bot typescript-bot removed Self Merge This PR can now be self-merged by the PR author or an owner Owner Approved A listed owner of this package signed off on the pull request. labels Feb 1, 2026
@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Waiting for Code Reviews in Pull Request Status Board Feb 1, 2026
@typescript-bot
Copy link
Contributor

@G-Rath Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

Copy link
Contributor

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

Copilot reviewed 1 out of 2 changed files in this pull request and generated no new comments.


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

@myabc
Copy link
Contributor Author

myabc commented Feb 2, 2026

@G-Rath I've pushed an additional commit that adds typings for StreamMessage/StreamSource. If you could take another look, that'd be great!

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

Labels

Author is Owner The author of this PR is a listed owner of the package.

Projects

Status: Waiting for Code Reviews

Development

Successfully merging this pull request may close these issues.

4 participants