Repository: TypeScript
Issue: emit code miss return type in .d.ts ( 3.9.0-dev.20200408 )
Labels: Needs Investigation

<!-- 🚨 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 the latest published version. It may have already been fixed.
For npm: `typescript@next`
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly
-->
**TypeScript Version:**  Version 3.9.0-dev.20200408

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:**

**Code**

```ts
export declare const lifecycleMap: {
	install: {
		readonly name: "install";
		readonly before: readonly ["preinstall"];
		readonly after: readonly ["postinstall", "prepublish", "prepare", "preshrinkwrap", "shrinkwrap", "postshrinkwrap"];
	};
	pack: {
		readonly name: "pack";
		readonly ignoreSelf: true;
		readonly before: readonly ["prepublish", "prepare", "prepack"];
		readonly after: readonly ["postpack"];
	};
	publish: {
		readonly name: "publish";
		readonly before: readonly ["prepublish", "prepare", "prepublishOnly", "prepack", "postpack"];
		readonly after: readonly ["postpublish"];
	};
};

export interface ILifecycleEntry
{
	readonly name: string;
	readonly ignoreSelf?: boolean;
	readonly before: readonly string[];
	readonly after: readonly string[];
}

export type ILifecycleMapKeys = keyof typeof lifecycleMap;

export type ILifecycleMap<K extends string = string> = typeof lifecycleMap & Record<K, ILifecycleEntry>;


export function getLifecycleCore<K extends ILifecycleMapKeys>(scriptName: string | K)
{
	if (isKnownLifecycleKey(scriptName))
	{
		return lifecycleMap[scriptName]
	}

	return (lifecycleMap as ILifecycleMap)[scriptName]
}

export function getLifecycle<K extends string | ILifecycleMapKeys>(scriptName: K)
{
	return getLifecycleCore(scriptName) ?? {
		name: scriptName,
		before: [
			`pre${scriptName}`
		],
		after: [
			`post${scriptName}`
		],
	}
}

export function isKnownLifecycleKey<K extends ILifecycleMapKeys>(scriptName: string | K): scriptName is ILifecycleMapKeys
{
	return scriptName in lifecycleMap
}
```

tsconfig.json
```json
{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es2019",
        "jsx": "preserve",
        "moduleResolution": "node",
        "allowJs": false,
        "allowUmdGlobalAccess": false,
        "sourceMap": true,
        "inlineSourceMap": false,
        "inlineSources": true,
        "declaration": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "allowSyntheticDefaultImports": true,
        "resolveJsonModule": true,
        "strict": false,
        "strictBindCallApply": true,
        "strictNullChecks": false,
        "strictFunctionTypes": true,
        "noImplicitThis": true,
        "preserveConstEnums": true,
        "forceConsistentCasingInFileNames": true,
        "incremental": true,
        "noErrorTruncation": true,
        "locale": "zh-TW",
        "removeComments": false,
        "traceResolution": false,
        "newLine": "lf",
        "esModuleInterop": true
    },
```

**Expected behavior:**

same as Playground
https://www.typescriptlang.org/v2/en/play?target=6&module=1&ts=3.9.0-beta#code/KYDwDg9gTgLgBAE2AYwDYEMrDsiA7AZ3lQEsAzFATzWAFl0wAuOAbwCgBIEwmdVVZuw4cs6BPlSU4edAFtgzAETcifVIoDcnEcDESpAI2BloCuKPF5JcANqKwWFb36KAuluEX9cdGRjAoZi8rKTtIIic1RQAaOHssMABXA1ICAAsYuIdgMExgTPjgdKhuAGsAdygGAuKyyurY+wgiWrwKqrA3DwBfD1zkUsFtYOsZeSV+0s1h3UtrEgBzPFMAZWBUMmYYKETgDx09ELgjEywg2e8whOTUjMbs3KwCh-QBrpnD619-QPMLo7CzRgk3eHF6nCSKRI6SGnn+ozkZnsN2hGX2I0MxlM50+oUKkNuzwSeSJORR6QA8iFSSD7kCQe4PnMpN8AjjmbYmkQCajQeDwWxQJBYHBuD8yK9sABJAAy5CoNAAonhtpQ2EIMdJEcwiCU8AsPJrFsssGsNgB+ZgGCAQVC6PCG+GY05mTW67gLGyMg4c1m-N3bD1erTdNiC8DQeAwShgaVyijIah2+hgADSwEoBDgAF44KUMxAyHBo7HC3BSAmk3QGFpw8KozG4-LEzQUwAeVNwUD+PAILPu-U5uADhYAPiHJeAZYrCuTDDgADI4AAlFDQBAd2Ky5tV5Wq0e1uuRuBkRJ4ZAwEj4OALYAweOz4AAYVMHa7IB7fbg28rrYY6czUcAAoCGQEowBgAA5bVh0DQcAB84FTABKdVOHIOAgOhVNlnKPAHxbO0AJAsCSAg6D5GQ1COCEHQYESKA8HLHc-zAGxQPAqDEVcThQ04LB6MYzCZ0I6swB8LMf0fFNkPY0jyO4tg+KFY9T3PS9r1ve8WLtN9u2AXt+zghY4EQqTRJTACCGAjiyK48YkNQjU7wYpitIIqsXywEjOIo4BkLgc1zVYbQxjMWyFPkaJtBObFbG0DgAANsgAEhYCL7OAbpEu0VxouEP1mBsBLkqBNKMr87Lcvy0NlIjEU1IvK8mOw3D8J04AAL0j8DK-cyq0sjNrJ8uy-J1YzTMcnV5My0VJI81irLQujXOHGa-NFJiRIGhglLYIA
tsc Version 3.9.0-dev.20200408
node v13.12.0

```ts
export declare function getLifecycle<K extends string | ILifecycleMapKeys>(scriptName: K): {
    readonly name: "install";
    readonly before: readonly ["preinstall"];
    readonly after: readonly ["postinstall", "prepublish", "prepare", "preshrinkwrap", "shrinkwrap", "postshrinkwrap"];
} | {
    readonly name: "pack";
    readonly ignoreSelf: true;
    readonly before: readonly ["prepublish", "prepare", "prepack"];
    readonly after: readonly ["postpack"];
} | {
    readonly name: "publish";
    readonly before: readonly ["prepublish", "prepare", "prepublishOnly", "prepack", "postpack"];
    readonly after: readonly ["postpublish"];
} | ILifecycleEntry;
```

**Actual behavior:**

```ts
export declare function getLifecycle<K extends string | ILifecycleMapKeys>(scriptName: K): {
    readonly name: "install";
    readonly before: readonly ["preinstall"];
    readonly after: readonly ["postinstall", "prepublish", "prepare", "preshrinkwrap", "shrinkwrap", "postshrinkwrap"];
} | {
    readonly name: "publish";
    readonly before: readonly ["prepublish", "prepare", "prepublishOnly", "prepack", "postpack"];
    readonly after: readonly ["postpublish"];
} | ILifecycleEntry;
```

```patch
  export declare function getLifecycle<K extends string | ILifecycleMapKeys>(scriptName: K): {
      readonly name: "install";
      readonly before: readonly ["preinstall"];
      readonly after: readonly ["postinstall", "prepublish", "prepare", "preshrinkwrap", "shrinkwrap", "postshrinkwrap"];
  } | {
-     readonly name: "pack";
-     readonly ignoreSelf: true;
-     readonly before: readonly ["prepublish", "prepare", "prepack"];
-     readonly after: readonly ["postpack"];
- } | {
      readonly name: "publish";
      readonly before: readonly ["prepublish", "prepare", "prepublishOnly", "prepack", "postpack"];
      readonly after: readonly ["postpublish"];
  } | ILifecycleEntry;
```

**Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior -->

**Related Issues:** <!-- Did you find other bugs that looked similar? -->