René's URL Explorer Experiment


Title: Proposal: Easier Migration with Types in JavaScript Files · Issue #23906 · microsoft/TypeScript · GitHub

Open Graph Title: Proposal: Easier Migration with Types in JavaScript Files · Issue #23906 · microsoft/TypeScript

X Title: Proposal: Easier Migration with Types in JavaScript Files · Issue #23906 · microsoft/TypeScript

Description: This issue is the dual of #22665. Background In last week's design meeting, we discussed #22665 and it seemed like we had some positive sentiment around the proposal. Specifically, issues where users hit an expressivity wall or mismatch ...

Open Graph Description: This issue is the dual of #22665. Background In last week's design meeting, we discussed #22665 and it seemed like we had some positive sentiment around the proposal. Specifically, issues where use...

X Description: This issue is the dual of #22665. Background In last week's design meeting, we discussed #22665 and it seemed like we had some positive sentiment around the proposal. Specifically, issues where...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/23906

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Proposal: Easier Migration with Types in JavaScript Files","articleBody":"This issue is the dual of #22665.\r\n\r\n# Background\r\n\r\nIn last week's design meeting, we discussed #22665 and it seemed like we had some positive sentiment around the proposal. Specifically, issues where users hit an expressivity wall or mismatch in `.js` when migrating to `.ts` files provide a compelling case.\r\n\r\nHowever, there are certain issues with the proposal:\r\n\r\n* It still requires users to make a file extension change from `.js` to `.ts`, which usually implies some change in build steps.\r\n* It provides no easy migration path from other type systems with annotation syntax used in `.js` files (see https://github.com/Microsoft/TypeScript-Babel-Starter/issues/1).\r\n* It introduces the concept of a \"diluted/loose\" TypeScript experience which can make things more confusing.\r\n\r\n# Proposal\r\n\r\nWe can introduce a new mode that enables TypeScript-specific constructs in `.js` files. This new mode would allow things like type annotations, `interface`s, class property annotations, etc. to be declared in `.js` files. Users would have to explicitly opt-in to this mode for transitionary purposes, with the end goal of migrating to TypeScript.\r\n\r\n## Supported constructs\r\n\r\nThe following constructs from TypeScript would be supported:\r\n\r\n* Type annotations (`: Foo`)\r\n* Interfaces (`interface Foo { /*...*/ }`)\r\n* Type alias (`type Foo = \"hello\" | \"world\"`)\r\n* `as`-style type assertions (`xyz as SomeType`)\r\n* Non-nullable type assertions (`x!.bar`)\r\n* Definite assignment assertions (`let x!: number`)\r\n* Enums (`enum E { /*...*/ }`)\r\n* Import aliases and export aliases:\r\n    * `import\r\n\r\n## Unsupported constructs\r\n\r\nThe following would not be supported to encourage users to write ECMAScript modules and standard enums that utilize late-binding.\r\n\r\n* Namespaces\r\n* `const` enums\r\n\r\n## Existing typed `.js` file semantics\r\n\r\nA JavaScript file still has the same specialized semantics including understanding things like CommonJS modules, JSDoc type annotations, ES5-style constructor functions, object literals potentially being open-ended, etc. However, in the presence of an analogous TypeScript construct, the TypeScript construct always wins. For example, the following declares `x` as type `number`, and potentially issues an error on the JSDoc.\r\n\r\n```ts\r\n/**\r\n * @type {string}\r\n */\r\nvar x: number;\r\n```\r\n\r\n# Drawbacks\r\n\r\nThis proposal avoids the aforementioned issues with #22665, but has some new drawbacks.\r\n\r\nFor one, it seems like there's little-to-no advantage to moving from a `.js` file to a `.ts` file, even though TypeScript is easier to reason about and make assumptions on (whereas much of our JavaScript semantics are more \"best-effort\").\r\n\r\nThe other issue, which is likely much bigger, is that this conflates where JavaScript ends and TypeScript begins. While the intent here is to make migration easier, enabling this functionality could be perceived poorly as an attempt to extend the language inappropriately. While we hope users understand this is **not** the case, we are extremely open to feedback from the community on this issue.\r\n\r\nIf this flag was called something like `--jsMigrationMode`, perhaps we could be explicit on the intent and also signal to users that having this flag on is not ideal.\r\n\r\n## Existing Precedent\r\n\r\nCommon usage of JSX and Flow in `.js` files in the Babel ecosystem (as opposed to using the `.jsx` file extensions) provides a reasonable precedent for supporting TypeScript constructs in `.js` files.","author":{"url":"https://github.com/DanielRosenwasser","@type":"Person","name":"DanielRosenwasser"},"datePublished":"2018-05-04T22:05:06Z","url":"https://github.com/microsoft/TypeScript/issues/23906"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d09a8f12-272d-fd48-446d-cd28cb4af215
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC758:34CAB:3224233:4028046:6B01DF7F
html-safe-nonceac7a472f172cc5a6f736a547e521954407d32c38d9885207c3c83b990cb6bcf1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzU4OjM0Q0FCOjMyMjQyMzM6NDAyODA0Njo2QjAxREY3RiIsInZpc2l0b3JfaWQiOiIxNzI4NzY2NTI3ODk5MDMzNDcxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd2d97d5115d3f091ce1c2e2d455b5df0d545490dda195da3a68029ae8cd3647f
hovercard-subject-tagissue:320443934
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/23906/issue_layout
twitter:imagehttps://opengraph.githubassets.com/38a5ff4dc6af8d746da57258025649cfb539fdba07ced739051752ab5c08a1d4/microsoft/TypeScript/issues/23906
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/38a5ff4dc6af8d746da57258025649cfb539fdba07ced739051752ab5c08a1d4/microsoft/TypeScript/issues/23906
og:image:altThis issue is the dual of #22665. Background In last week's design meeting, we discussed #22665 and it seemed like we had some positive sentiment around the proposal. Specifically, issues where use...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameDanielRosenwasser
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/23906#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F23906
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F23906
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/23906
Reloadhttps://github.com/microsoft/TypeScript/issues/23906
Reloadhttps://github.com/microsoft/TypeScript/issues/23906
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests312 (312)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/23906
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/23906
Proposal: Easier Migration with Types in JavaScript Fileshttps://github.com/microsoft/TypeScript/issues/23906#top
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on May 4, 2018https://github.com/microsoft/TypeScript/issues/23906#issue-320443934
#22665https://github.com/microsoft/TypeScript/issues/22665
#22665https://github.com/microsoft/TypeScript/issues/22665
Using typescript babel to transition from flow TypeScript-Babel-Starter#1https://github.com/microsoft/TypeScript-Babel-Starter/issues/1
#22665https://github.com/microsoft/TypeScript/issues/22665
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on May 4, 2018https://github.com/microsoft/TypeScript/issues/23906#event-1610917508
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on May 4, 2018https://github.com/microsoft/TypeScript/issues/23906#issuecomment-386750161
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%22
on Jul 25, 2018https://github.com/microsoft/TypeScript/issues/23906#event-1753534281
https://github.com/sibelius
Sibelius Seraphini (sibelius)https://github.com/sibelius
on Jul 26, 2018https://github.com/microsoft/TypeScript/issues/23906#issuecomment-408100164
https://github.com/rbiggs
Robert Biggs (rbiggs)https://github.com/rbiggs
on Jul 26, 2018https://github.com/microsoft/TypeScript/issues/23906#issuecomment-408139633
https://github.com/mihailik
mihailikhttps://github.com/mihailik
on Aug 1, 2018https://github.com/microsoft/TypeScript/issues/23906#issuecomment-409565524
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on Jul 16, 2019https://github.com/microsoft/TypeScript/issues/23906#event-2487271548
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/23906
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/23906
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.