Repository: TypeScript
Issue: Adjacent .d.ts file stops working when using import path aliases
Labels: Bug

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section!

Please help us by doing the following steps before logging an issue:
  * Search: https://github.com/Microsoft/TypeScript/search?type=Issues
  * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ

Please fill in the *entire* template below.
-->

<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:**  3.4.0-dev.201xxxxx

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:**

We make quite heavy use of the Typescript feature that allows one to declare a `.d.ts` file adjacent to a json file in order to manually declare the type of the json object (rather than have Typescript scan the json file and determine the type itself). This is very useful because (a) we can name types in the json file, where they would otherwise all be anonymous and (b) sometimes Typescript attempts to declare the type of the json file as an enormous union of all the string literal types in the file.

A few days ago we also introduced an import path alias so that we can use the .NET-style `~` sigil to refer to the root of the project which works great but has, unfortunately, broken all the `.d.ts` files next to json files and Typescript has reverted to scanning the json file for a type. 

Here's a minimal example:

 ---

## resources.json

```json
{
  "incorrect" : ""
}
```

 ---

## resources.json.d.ts

```typescript
type ResourceCollection = {
  resources: Record<string, Resource>;
};

type Resource = {
  value: string;
};

declare const resources: ResourceCollection;

export default resources;

```

 ---

## json-demo.ts

```typescript
import resources from './resources.json';
import resources2 from '~/resources.json';

type A = typeof resources;

type B = typeof resources2;

```

---

## Tsconfig.json

```json
{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "target": "es2015",
    "module": "es2015",
    "strict": true,
    "jsx": "react",
    "allowJs": true,
    "declaration": false,
    "resolveJsonModule": true,
    "baseUrl": ".",
    "paths": {
      "~/*": ["src/*"]
    }
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

```


**Expected behavior:**

The two imports `resources` and `resources2` refer to the same file, so `type A` and `type B` should have the same definition.

**Actual behavior:**

Hovering over `A` gives: 

```typescript
type A = {
    resources: Record<string, Resource>;
}
```

whereas `B` gives: 

```typescript
type B = {
    "incorrect": string;
}
```

**Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior -->

**Related Issues:** <!-- Did you find other bugs that looked similar? -->