Skip to content

[@hotwired/turbo] Add missing types, update for 8.0.23#74439

Merged
typescript-bot merged 6 commits into
DefinitelyTyped:masterfrom
myabc:feature/hotwired__turbo-additional-types
Feb 3, 2026
Merged

[@hotwired/turbo] Add missing types, update for 8.0.23#74439
typescript-bot merged 6 commits into
DefinitelyTyped:masterfrom
myabc:feature/hotwired__turbo-additional-types

Conversation

@myabc

@myabc myabc commented Jan 31, 2026

Copy link
Copy Markdown
Contributor

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

typescript-bot commented Jan 31, 2026

Copy link
Copy Markdown
Contributor

@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 have passed
  • ✅ Most recent commit is approved by type definition owners, DT maintainers or others

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 74439,
  "author": "myabc",
  "headCommitOid": "6bcb9b9b84b62c11541a91e6561d6e729c688dd8",
  "mergeBaseOid": "66d4b7d2fced2e4451c633615cdeef79e3ef2525",
  "lastPushDate": "2026-01-31T23:20:00.000Z",
  "lastActivityDate": "2026-02-03T08:35:08.000Z",
  "mergeOfferDate": "2026-02-03T08:33:39.000Z",
  "mergeRequestDate": "2026-02-03T08:35:08.000Z",
  "mergeRequestUser": "myabc",
  "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": "approved",
      "reviewer": "G-Rath",
      "date": "2026-02-03T00:19:30.000Z",
      "isMaintainer": false
    }
  ],
  "mainBotCommentID": 3829572796,
  "ciResult": "pass"
}

@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
Copy Markdown
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

DangerBotOSS commented Jan 31, 2026

Copy link
Copy Markdown
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/danger@11.3.1_encoding@0.1.13/node_modules/danger/distribution/platforms/github/customGitHubRequire.js:131:16)
    at _module2.default._load (/home/runner/work/DefinitelyTyped/DefinitelyTyped/node_modules/.pnpm/override-require@1.1.1/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/require-from-string@2.0.2/node_modules/require-from-string/index.js:28:4)
    at /home/runner/work/DefinitelyTyped/DefinitelyTyped/node_modules/.pnpm/danger@11.3.1_encoding@0.1.13/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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread types/hotwired__turbo/hotwired__turbo-tests.ts
Comment thread types/hotwired__turbo/hotwired__turbo-tests.ts
Comment thread types/hotwired__turbo/hotwired__turbo-tests.ts
@myabc myabc changed the title Flesh out typings for @hotwired/turbo [@hotwired/turbo] Add missing types, update for 8.0.23 Jan 31, 2026

@G-Rath G-Rath left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Awesome, thanks!

Comment thread types/hotwired__turbo/index.d.ts Outdated
@typescript-bot

Copy link
Copy Markdown
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
@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

@myabc myabc requested a review from G-Rath February 1, 2026 04:18
myabc and others added 5 commits February 3, 2026 05:29
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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
@myabc myabc force-pushed the feature/hotwired__turbo-additional-types branch from ba96c85 to 6bcb9b9 Compare February 3, 2026 08:29
@typescript-bot

Copy link
Copy Markdown
Contributor

🛂 Hi @myabc,

I can't accept a pull request until all of the checks in the "Status" section of this comment are green. I will let you know once that happens.

Thanks, and happy typing!

@typescript-bot typescript-bot added the Self Merge This PR can now be self-merged by the PR author or an owner label Feb 3, 2026
@typescript-bot

Copy link
Copy Markdown
Contributor

@myabc: Everything looks good here. I am ready to merge this PR (at 6bcb9b9) on your behalf whenever you think it's ready.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@G-Rath, @lukeify: you can do this too.)

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Waiting for Author to Merge in Pull Request Status Board Feb 3, 2026
@myabc

myabc commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

Ready to merge

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in Pull Request Status Board Feb 3, 2026
@typescript-bot typescript-bot merged commit 6a5c633 into DefinitelyTyped:master Feb 3, 2026
3 checks passed
myabc added a commit to opf/openproject that referenced this pull request Feb 3, 2026
joanlopez pushed a commit to grafana/k6-DefinitelyTyped that referenced this pull request Feb 11, 2026
… update for 8.0.23 by @myabc

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
myabc added a commit to opf/openproject that referenced this pull request Mar 1, 2026
myabc added a commit to opf/openproject that referenced this pull request Mar 2, 2026
myabc added a commit to opf/openproject that referenced this pull request Mar 3, 2026
myabc added a commit to opf/openproject that referenced this pull request Mar 9, 2026
myabc added a commit to opf/openproject that referenced this pull request May 25, 2026
myabc added a commit to opf/openproject that referenced this pull request May 25, 2026
myabc added a commit to opf/openproject that referenced this pull request May 26, 2026
myabc added a commit to opf/openproject that referenced this pull request May 26, 2026
myabc added a commit to opf/openproject that referenced this pull request May 26, 2026
myabc added a commit to opf/openproject that referenced this pull request May 26, 2026
myabc added a commit to opf/openproject that referenced this pull request May 26, 2026
myabc added a commit to myabc/DefinitelyTyped that referenced this pull request Jul 4, 2026
StreamMessage and BrowserAdapter were declared as exported
classes, but @hotwired/turbo does not export either at runtime
(neither appears in the dist export surface), so value imports
compiled but resolved to undefined. Introduced in DefinitelyTyped#74439.

Convert both to interfaces: StreamMessage keeps its instance
shape (fragment) for renderStreamMessage(); BrowserAdapter now
extends Adapter, keeping progressBar and the members it makes
non-optional. Tests assert both names are no longer usable as
values.

Fixes DefinitelyTyped#75207
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. 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants