Skip to content
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

release: 3.1.0 #318

Merged
merged 1 commit into from
Mar 15, 2024
Merged

release: 3.1.0 #318

merged 1 commit into from
Mar 15, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Dec 5, 2023

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

types-react-codemod@3.1.0

Minor Changes

  • Add codemod to replace deprecated ReactFragment by inlining its actual type (#326 ed97a70 by @eps1lon)

    import * as React from 'react';
    
    -const node: React.ReactFragment
    +const node: Iterable<React.ReactNode>
  • Add codemod to replace deprecated React types related to propTypes with their counterpart from the prop-types package (#357 1751318 by @eps1lon)

    +import * as PropTypes from "prop-types";
     import * as React from "react";
    -declare const requireable: React.Requireable<React.ReactNode>;
    +declare const requireable: PropTypes.Requireable<React.ReactNode>;
    -declare const validator: React.Validator<React.ReactNode>;
    +declare const requireable: PropTypes.Validator<React.ReactNode>;
    -declare const validationMap: React.ValidationMap<{}>;
    +declare const requireable: PropTypes.ValidationMap<React.ReactNode>;
    -declare const weakValidationMap: React.WeakValidationMap<{}>;
    +declare const requireable: PropTypes.WeakValidationMap<React.ReactNode>;
  • Add codemod for required initial value in useRef (#217 0047404 by @eps1lon)

    Added as useRef-required-initial.
    Can be used on 18.x types but only intended for once [react] Require initial value for useRef DefinitelyTyped/DefinitelyTyped#64920 lands.

  • Unflag codemods for new refs (#319 80fe29c by @eps1lon)

    Just removing their experimental prefix since we have increased confidence in these changes after seeing their impact internally.

    -experimental-refobject-defaults
    +refobject-defaults
  • Add codemod to replace LegacyRef with Ref (#347 e928761 by @eps1lon)

  • Add codemod to replace deprecated ReactNodeArray by inlining its actual type. (#325 b7f757c by @eps1lon)

    import * as React from 'react';
    
    -const node: React.ReactNodeArray
    +const node: ReadonlyArray<React.ReactNode>

Patch Changes

  • Added missing transforms as choices to preset-19 (#341 dc10a3d by @eps1lon)

  • Ensure added imports of types use the type modifier (#343 f05624f by @eps1lon)

    If we'd previously add an import to JSX (e.g. in scoped-jsx),
    the codemod would import it as a value.
    This breaks TypeScript projects using verbatimModuleSyntax as well as projects enforcing type imports for types.

    Now we ensure new imports of types use the type modifier:

    -import { JSX } from 'react'
    +import { type JSX } from 'react'

    This also changes how we transform the deprecated global JSX namespace.
    Instead of rewriting each usage, we opt for adding another import.
    The guiding principle being that we keep the changes minimal in a codemod.

    Before:

    import * as React from 'react'
    
    -const element: JSX.Element
    +const element: React.JSX.Element

    After:

    import * as React from 'react'
    +import { type JSX } from 'react'
    
    const element: JSX.Element

    Note that rewriting of imports does not change the modifier.
    For example, the deprecated-vfc-codemod rewrites VFC identifiers to FC.
    If the import of VFC had no type modifier, the codemod will not add one.

    type modifiers for import specifiers require [TypeScript 4.5 which has reached EOL](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window in DefinitelyTyped) which is a strong signal that you should upgrade to at least TypeScript 4.6 by now.

  • Ensure replace and rename codemods have consistent behavior (#348 a62832e by @eps1lon)

    Fixes multiple incorrect transform patterns that were supported by some transforms but not others.
    We no longer switch to type imports if the original type wasn't imported with that modifier.
    Type parameters are now consistently preserved.
    We don't add a reference to the React namespace anymore if we can just add a type import.

    This affects the following codemods:

    • deprecated-legacy-ref
    • deprecated-react-child
    • deprecated-react-text
    • deprecated-react-type
    • deprecated-sfc-element
    • deprecated-sfc
    • deprecated-stateless-component
    • deprecated-void-function-component
  • Find and replace type usage in type parameters of call expressions (#344 8c27551 by @eps1lon)

    Now we properly detect that e.g. JSX is used in someFunctionWithTypeParameters<JSX>().

    Affected codemods:

    • deprecated-react-child
    • deprecated-react-text
    • scoped-jsx

@eps1lon eps1lon mentioned this pull request Dec 5, 2023
16 tasks
@eps1lon eps1lon changed the title Version Packages release: 3.1.0 Dec 6, 2023
@github-actions github-actions bot changed the title release: 3.1.0 Version Packages Dec 6, 2023
@github-actions github-actions bot force-pushed the changeset-release/main branch 11 times, most recently from dde5f80 to b1fb75b Compare January 2, 2024 11:07
@github-actions github-actions bot force-pushed the changeset-release/main branch 3 times, most recently from 0c1c1a5 to 86f949f Compare January 17, 2024 21:20
@github-actions github-actions bot force-pushed the changeset-release/main branch 9 times, most recently from a9975fe to 15e246f Compare February 13, 2024 20:02
@github-actions github-actions bot force-pushed the changeset-release/main branch 2 times, most recently from 66d607e to cc556a8 Compare February 15, 2024 12:43
@github-actions github-actions bot force-pushed the changeset-release/main branch 8 times, most recently from e6cc48f to aa686e2 Compare February 26, 2024 12:59
@github-actions github-actions bot force-pushed the changeset-release/main branch 5 times, most recently from 6f84710 to 52f4db3 Compare March 15, 2024 21:41
@eps1lon eps1lon changed the title Version Packages release: 3.1.0 Mar 15, 2024
@eps1lon eps1lon merged commit b466f46 into main Mar 15, 2024
@eps1lon eps1lon deleted the changeset-release/main branch March 15, 2024 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

1 participant