Repository: TypeScript
Issue: Entry point of ts files at the package.json level
Labels: Suggestion,Awaiting More Feedback

# Suggestion

<!--
  Please fill in each section completely. Thank you!
-->

## 🔍 Search Terms

<!--
  💡 Did you know? TypeScript has over 2,000 open suggestions!
  🔎 Please search thoroughly before logging new feature requests as most common ideas already have a proposal in progress.
  The "Common Feature Requests" section of the FAQ lists many popular requests: https://github.com/Microsoft/TypeScript/wiki/FAQ#common-feature-requests

  Replace the text below:
-->

import ts without precompilation

## ✅ Viability Checklist

<!--
   Suggestions that don't meet all these criteria are very, very unlikely to be accepted.
   We always recommend reviewing the TypeScript design goals before investing time writing
   a proposal for ideas outside the scope of the project.
-->
My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).


## ⭐ Suggestion

Support for importing ts files at the package level.

<!-- A summary of what you'd like to see added or changed -->

## 📃 Motivating Example

Adding typescript entry points `ts-module` and `ts-import` to package.json

```json

{
  "version": "1.0.0",
  "name": "@scope/foo",
  "module": "dist/index.mjs",
  "main": "dist/index.js",
  "types": "types/index.d.ts",
  "ts-module": "src/index.ts",
  "exports": {
    ".": {
      "import": "./dist/index.mjs",
      "require": "./dist/index.js",
      "ts-import": "./src/index.ts"
    }
  }
}
```

<!--
  If you were announcing this feature in a blog post, what's a short explanation that shows
  a developer why this feature improves the language?
-->

## 💻 Use Cases

<!--
  What do you want to use this for?
  What shortcomings exist with current approaches?
  What workarounds are you using in the meantime?
-->

This will improve the developer experience. No need to compile files, work directly from source codes. The types folder with d.ts files is no longer needed during custom code development.

When developing packages in the workspace, for example: @scope/foo, @scope/bar. (each package is compiled separately)
@scope/bar depends on @scope/foo.

index.ts in @scope/bar:
```js
import { MyInterface } from '@scope/foo';  // !!!< scope/foo must be pre-compiled
```

Now, in order for this to work without compilation, and the import went straight from the source codes, you need to add the following construction to tsconfig.json:

```json
"paths": {
  "@scope/foo": ["./foo/src/index"]
}
```

This approach has a problem after compiling @scope/bar with d.ts files.
d.ts files appear in DeclarationDir that are needed for another package (@scope/foo)