From 39965367d2ce2d730bdaf2af5c8bcf4e316de18d Mon Sep 17 00:00:00 2001
From: ViieeS <vies@list.ru>
Date: Wed, 7 Oct 2020 06:24:49 +0300
Subject: [PATCH] Update paths.js
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add `.d.ts` extension support

Without it test fails when you try to import `.d.ts` using shorten form (eg. `import {TODO_ANY} from 'src/react-app-env';`)

```
> react-ts-app@0.1.0 test /react-ts-app
> react-scripts test
 FAIL  src/App.test.tsx
  ● Test suite failed to run

    Cannot find module './react-app-env' from 'App.tsx'

    However, Jest was able to find:
        './react-app-env.d.ts'

    You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'].

    See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

    However, Jest was able to find:
        './App.css'
        './App.test.tsx'
        './App.tsx'

    You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'].
```
---
 packages/react-scripts/config/paths.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/packages/react-scripts/config/paths.js b/packages/react-scripts/config/paths.js
index 516513081..4c9e01324 100644
--- a/packages/react-scripts/config/paths.js
+++ b/packages/react-scripts/config/paths.js
@@ -41,6 +41,7 @@ const moduleFileExtensions = [
   'json',
   'web.jsx',
   'jsx',
+  'd.ts',
 ];
 
 // Resolve file paths in the same order as webpack
-- 
GitLab