javascript-to-typescript

Migrate JavaScript to TypeScript

Example

steps:
  # process .js files
  - tools:
      - name: find_files_by_name_with_regex
        arguments:
          find_file_name_pattern: '.js$'
        returns: files
      - name: for_each
        items: '{{ files }}'
        each_item:
          item_name: file
          tools:
            - name: edit_file
              arguments:
                path_to_file: '{{ file }}'
                edit_prompt: |
                  Convert to TypeScript.  Define new types and enums as needed.
            - name: change_file_extension
              arguments:
                path_to_file: '{{ file }}'
                new_extension: '.ts'

  # process .jsx files
  - tools:
      - name: find_files_by_name_with_regex
        arguments:
          find_file_name_pattern: '.jsx$'
        returns: files
      - name: for_each
        items: '{{ files }}'
        each_item:
          item_name: file
          tools:
            - name: edit_file
              arguments:
                path_to_file: '{{ file }}'
                edit_prompt: |
                  Convert to TypeScript.  Define new types and enums as needed.
            - name: change_file_extension
              arguments:
                path_to_file: '{{ file }}'
                new_extension: '.tsx'

  # update package.json
  - tools:
      - name: find_files_by_name_with_regex
        arguments:
          find_file_name_pattern: 'package.json'
        returns: files
      - name: for_each
        items: '{{ files }}'
        each_item:
          item_name: file
          tools:
            - name: edit_file
              arguments:
                path_to_file: '{{ file }}'
                edit_prompt: |
                  Update this package.json file to support TypeScript

Last updated