Title: Importing untyped JS modules · Issue #3019 · microsoft/TypeScript · GitHub
Open Graph Title: Importing untyped JS modules · Issue #3019 · microsoft/TypeScript
X Title: Importing untyped JS modules · Issue #3019 · microsoft/TypeScript
Description: I have been trying out the 1.5 beta, but I am confused about importing modules from 3rd-party JS libraries. As I understand it, TS is intended as a superset of JS so if, for example, I have a CommonJS library called foo.js, then in my ap...
Open Graph Description: I have been trying out the 1.5 beta, but I am confused about importing modules from 3rd-party JS libraries. As I understand it, TS is intended as a superset of JS so if, for example, I have a Commo...
X Description: I have been trying out the 1.5 beta, but I am confused about importing modules from 3rd-party JS libraries. As I understand it, TS is intended as a superset of JS so if, for example, I have a Commo...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/3019
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Importing untyped JS modules","articleBody":"I have been trying out the 1.5 beta, but I am confused about importing modules from 3rd-party JS libraries. As I understand it, TS is intended as a superset of JS so if, for example, I have a CommonJS library called foo.js, then in my app.ts, I should be able to do:\n\n``` js\nimport foo from 'foo';\n```\n\nAnd this should be compiled (depending on my compile options) into a CommonJS require statement, which can then be consumed by Node, Browserify, etc.\n\nThis works in regular JavaScript (as compiled by Babel), but it does not work in TypeScript. I get a compiler error saying \"Cannot find external module 'foo'\".\n\nI understand that I can maybe write a .ts.d file that describes this library, but what if I don't want to do this? What if I just want to import a module and use it, as I would in regular JS?\n","author":{"url":"https://github.com/jonrimmer","@type":"Person","name":"jonrimmer"},"datePublished":"2015-05-04T11:28:59Z","url":"https://github.com/microsoft/TypeScript/issues/3019"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:31f13f69-5a5c-703e-1eb2-42e01121f5ec |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D320:3D38E3:A128:E6F8:6AFBB462 |
| html-safe-nonce | 08bf87433e9a7d9d4446c5d33cbc277896c21541725f840629d35fb4ee4c1856 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzIwOjNEMzhFMzpBMTI4OkU2Rjg6NkFGQkI0NjIiLCJ2aXNpdG9yX2lkIjoiNTU0Njg2NTk3MDUyNDc4NTYyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | eebd4c79b63c59bc0e92bb875be0f9181cd6680041fb603871ca383a4c4607ac |
| hovercard-subject-tag | issue:72996233 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/3019/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f6043e05c0eaed5a9040da81c2e492f53bfcffb71fb6865fa87ecdd5ad041019/microsoft/TypeScript/issues/3019 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f6043e05c0eaed5a9040da81c2e492f53bfcffb71fb6865fa87ecdd5ad041019/microsoft/TypeScript/issues/3019 |
| og:image:alt | I have been trying out the 1.5 beta, but I am confused about importing modules from 3rd-party JS libraries. As I understand it, TS is intended as a superset of JS so if, for example, I have a Commo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jonrimmer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b2ef9c1578c18d8ed27027940544c958743213cf4461659f14d3ccdf51e162c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4cce0e99cf61481a318ff12c2e8580153a6c7c6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width