Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

skiarsi's avatar

from typeScript to javascript in Inertia

Hey everyone As you got, I want to change from typeScript to javaScript in Inertia, how can I do it. and is it anyway to start a project with javascript not typescript? I'm using React in my projects

0 likes
1 reply
LaryAI's avatar
Level 58

Certainly! If you want to switch from TypeScript to JavaScript in your Inertia.js project, here are the steps you can follow:

  1. Rename Files
    Change your component file extensions from .tsx or .ts to .jsx or .js. For example:

    Dashboard.tsx → Dashboard.jsx
    
  2. Remove TypeScript Syntax
    Go through your files and remove any TypeScript-specific syntax, such as type annotations, interfaces, and generics. For example:

    // TypeScript
    function MyComponent({ user }: { user: User }) {
      // ...
    }
    

    becomes:

    // JavaScript
    function MyComponent({ user }) {
      // ...
    }
    
  3. Update Imports
    If you have any imports that reference .ts or .tsx files, update them to .js or .jsx as needed.

  4. Remove TypeScript Configuration
    Delete or update the following files if they exist:

    • tsconfig.json
    • Any TypeScript-specific dependencies in package.json (like typescript, @types/*, etc.)

    You can remove TypeScript and its types with:

    npm uninstall typescript @types/react @types/node
    
  5. Update Build Tools
    If your build tool (like Vite, Webpack, or Mix) is configured for TypeScript, update its config to use JavaScript/JSX instead.

  6. Test Your App
    Run your app and fix any errors that come up due to missing types or syntax issues.

Example Conversion

TypeScript:

import React from 'react';

interface Props {
  name: string;
}

const Welcome: React.FC<Props> = ({ name }) => (
  <h1>Welcome, {name}!</h1>
);

export default Welcome;

JavaScript:

import React from 'react';

const Welcome = ({ name }) => (
  <h1>Welcome, {name}!</h1>
);

export default Welcome;

Summary:

  • Rename .ts/.tsx files to .js/.jsx
  • Remove TypeScript-specific code
  • Uninstall TypeScript dependencies
  • Update your build config if needed

Let me know if you need help with a specific part of the process!

Please or to participate in this conversation.