Skip to content

Stop putting react-app-env.d.ts in src #6560

Open
@devuxer

Description

@devuxer

(This pertains to CRA w/ the --typescript flag.)

Putting a loose d.ts file at the top level of src adds clutter and breaks the convention of putting all d.ts files together in a folder, such as "types".

Suggestions to remedy this (in order of preference):

  1. Honor the new location of react-app-env.d.ts if we move it.
  2. Allow us to configure where this file goes.
  3. Place the file in src/types.

EDIT:

@nhooyr Given its confusing, you could also add a comment to the generated file explaining why its there.

@bugzpodder This file was created to include create-react-app specific types. Removing it will cause errors like:

TypeScript error in ~/src/App.tsx(2,18):
Cannot find module './logo.svg'.  TS2307

    1 | import React from 'react';
  > 2 | import logo from './logo.svg';
      |                  ^
    3 | import './App.css';
    4 | 
    5 | const App: React.FC = () => {

This was created from #5611 if you want more details.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions