Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Flow CodemorphsNew to Visual Studio Code? Get it now.
Flow Codemorphs

Flow Codemorphs

vscodeshift

|
134 installs
| (0) | Free
general purpose codemods for flow
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

@vscodeshift/flow-codemorphs

CircleCI semantic-release Commitizen friendly Visual Studio Marketplace Version

general purpose codemods for flow

Commands

  • make exact
  • make inexact
  • make read-only

make exact

Converts object shape types to exact objects.

If you position the cursor inside a type annotation, only objects within that type annotation are converted.

If there is a selection, only objects within the selection are converted.

Example

Before


// @flow

type Foo = {
  bar: number,
  baz: Array<{
    qux: number,
    blah: $ReadOnly<{
      blsdf: string,
    }>,
    glorb: {a: number}[],
    ...
  }>,
}

After


// @flow

type Foo = {|
  bar: number,
  baz: Array<{|
    qux: number,
    blah: $ReadOnly<{| blsdf: string |}>,
    glorb: {| a: number |}[],
  |}>,
|}

make inexact

Converts object shape types to inexact objects.

If you position the cursor inside a type annotation, only objects within that type annotation are converted.

If there is a selection, only objects within the selection are converted.

Example

Before


// @flow

type Foo = {|
  bar: number,
  baz: Array<{
    qux: number,
    blah: $ReadOnly<{|
      blsdf: string,
    |}>,
    glorb: {a: number}[],
    ...
  }>,
|}

After


// @flow

type Foo = {
  bar: number,
  baz: Array<{
    qux: number,
    blah: $ReadOnly<{ blsdf: string, ... }>,
    glorb: { a: number, ... }[],
    ...
  }>,
  ...
}

make read-only

Converts mutable object shape and array types to readonly types.

If you position the cursor inside a type annotation, only objects and arrays within that type annotation are converted.

If there is a selection, only objects and arrays within the selection are converted.

Example

Before

// @flow

type Foo = {
  bar: number
  baz: Array<{
    qux: number
    blah: $ReadOnly<{
      blsdf: string
    }>
    glorb: { a: number }[]
  }>
}

After

// @flow

type Foo = $ReadOnly<{
  bar: number
  baz: $ReadOnlyArray<
    $ReadOnly<{
      qux: number
      blah: $ReadOnly<{
        blsdf: string
      }>
      glorb: $ReadOnlyArray<$ReadOnly<{ a: number }>>
    }>
  >
}>
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft