Repository navigation
feat: report type errors for disabled features - #56
Draft
KevinVandy wants to merge 1 commit into
Draft
KevinVandy wants to merge 1 commit into
KevinVandy wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: da80583 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes TypeScript report an error where app code uses a feature that
redact()turns off.redact()writessrc/redact.gen.d.tsfrom the resolved feature flags. The file has one/// <reference types="@tanstack/redact/disabled/<feature>" />line per disabled feature. It is rewritten only when its content changes. The newdtsoption sets another path or turns the file off. Withoutsrc/, the default file is skipped. A custom path whose directory is missing logs a warning.packages/redact/disabled/*.d.tsmerge into@types/reactand@types/react-dom. Declaration merging can only add, so each file makes the existing API unusable:<Activity>,<Suspense>, context providers, andforwardRef()get a requiredneverprop. The prop name is the error message.lazy(),createPortal(), andhydrateRoot()get an overload that takes priority and returns an unusable type. The overload is also marked@deprecated.render,setState, andcomponentWillUnmountget conflicting overloads. A class that uses none of them still satisfiesComponentType.memo()andaddTransitionType()are only marked@deprecated, because turning them off changes performance or animation rather than behavior.fragmentRefshas no type check.@types/reactand@types/react-domare optional peer dependencies, so pnpm links the same copy the app uses.tests/feature-types.test.tstype-checks a fixture against@types/react19.3 withskipLibCheck: false. Errors appear only on marked lines, enabled features add none, and the language service reports the expected deprecations.examples/feature-typesturns off every feature and then uses each one.pnpm typecheckthere reports 12 errors.ssr-demosetsdts: falsebecause its tsconfig mapsreactto Redact's source.Notes
The file is written by default, so every Vite project with a
src/folder gets one. With the full preset it only referencesviewTransitions. We may want to make it opt-in before release. Only the app's own source is checked. Compiled dependencies are not.