Parcel: Automatically install Typescript types

Created on 9 Apr 2018  路  2Comments  路  Source: parcel-bundler/parcel

馃檵 feature request

Not sure which level of Typescript support we want to have on Parcel, but since we have the TypeScriptAsset I thought it will be cool to automatically add external types.

This is something that the end user will have to do by hand otherwise and its how the Typescript ecosystem works.

馃帥 Configuration (.babelrc, package.json, cli command)

No custom configuration needed

馃 Expected Behavior

When requiring external modules from .ts and .tsx files, I'd expect Parcel to try to install the appropriate typing from DefinitelyTyped

馃槸 Current Behavior

No typing are installed and Typescript can't find types for external dependency

馃拋 Possible Solution

馃敠 Context

馃捇 Code Sample

Having the following app

import * as React from 'react';
import * as ReactDOM from 'react-dom';

I'd expect the following types to be installed:

  • @types/react
  • @types/react-dom

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | ^1.7.0
| Node | 8.4.0
| npm/Yarn | 1.3.2
| Operating System | Mac

Feature RFC TypeScript

Most helpful comment

I'd actually vote against this feature, because there are quite alot of cases where the typedef files on DefinitelyTyped that are out of date. So, if you have [email protected] and parcel will auto-install @types/package to your node_modules, you will get typing errors.
IMHO typings should be added manually and gradually, otherwise - chaos ensues :)

All 2 comments

I'd actually vote against this feature, because there are quite alot of cases where the typedef files on DefinitelyTyped that are out of date. So, if you have [email protected] and parcel will auto-install @types/package to your node_modules, you will get typing errors.
IMHO typings should be added manually and gradually, otherwise - chaos ensues :)

FYI: Some editors like vscode already fetch typings automatically. No need to duplicate that functionality in parcel.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dotdash picture dotdash  路  3Comments

466023746 picture 466023746  路  3Comments

davidnagli picture davidnagli  路  3Comments

algebraic-brain picture algebraic-brain  路  3Comments

donaldallen picture donaldallen  路  3Comments