René's URL Explorer Experiment


Title: emitDecoratorMetadata combined with template literals throws exception and exits · Issue #38428 · microsoft/TypeScript · GitHub

Open Graph Title: emitDecoratorMetadata combined with template literals throws exception and exits · Issue #38428 · microsoft/TypeScript

X Title: emitDecoratorMetadata combined with template literals throws exception and exits · Issue #38428 · microsoft/TypeScript

Description: This is an edge case, but my team for various reasons decided to use template literals everywhere instead of strings. In almost all cases this seems to not have any drawbacks, except this case I'm reporting and one other edge case I may ...

Open Graph Description: This is an edge case, but my team for various reasons decided to use template literals everywhere instead of strings. In almost all cases this seems to not have any drawbacks, except this case I'm ...

X Description: This is an edge case, but my team for various reasons decided to use template literals everywhere instead of strings. In almost all cases this seems to not have any drawbacks, except this case I...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"emitDecoratorMetadata combined with template literals throws exception and exits","articleBody":"This is an edge case, but my team for various reasons decided to use template literals everywhere instead of strings.  In almost all cases this seems to not have any drawbacks, except this case I'm reporting and one other edge case I may report separately.  Maybe we shouldn't be using template literals in this spot, but the transpilation should probably not crash regardless.  In our scenario `emitDecoratorMetadata` is required (for TypeORM) and that option is required to reproduce the bug.\r\n\r\n**TypeScript Version:**  \r\n3.8.3\r\ntypescript@next 4.0.0-dev.20200508\r\n\r\n**Search Terms:**\r\ndecorator\r\nquotes\r\nbacktick\r\n\r\n**Code**\r\n\r\n```ts\r\nimport \"reflect-metadata\";\r\n\r\nconst formatMetadataKey = Symbol(\"format\");\r\n\r\nfunction format(formatString: string) {\r\n  return Reflect.metadata(formatMetadataKey, formatString);\r\n}\r\n\r\nfunction getFormat(target: any, propertyKey: string) {\r\n  return Reflect.getMetadata(formatMetadataKey, target, propertyKey);\r\n}\r\n\r\n\r\nclass Greeter {\r\n  @format(\"Hello, %s\")\r\n  greeting: `boss` | `employee` = `employee`;  //template literals on this line cause the issue\r\n\r\n  constructor(message: 'boss' | 'employee') {\r\n    this.greeting = message;\r\n  }\r\n  greet() {\r\n    const formatString = getFormat(this, \"greeting\");\r\n    return formatString.replace(\"%s\", this.greeting);\r\n  }\r\n}\r\n\r\nconst g = new Greeter('boss')\r\ng.greet()\r\n```\r\n\r\n**Expected behavior:**\r\nCompiles normally.\r\n\r\n**Actual behavior:**\r\nThrows exception: \r\n```\r\n/Users/jcullison/.config/yarn/global/node_modules/typescript/lib/tsc.js:81040\r\n                throw e;\r\n                ^\r\nError: Debug Failure. Unexpected node.\r\nNode 14 was unexpected.\r\n    at serializeTypeNode (/Users/jcullison/.config/yarn/global/node_modules/typescript/lib/tsc.js:64342:45)\r\n    at serializeTypeList (/Users/jcullison/.config/yarn/global/node_modules/typescript/lib/tsc.js:64391:44)\r\n    at serializeTypeNode (/Users/jcullison/.config/yarn/global/node_modules/typescript/lib/tsc.js:64356:28)\r\n    at serializeTypeOfNode (/Users/jcullison/.config/yarn/global/node_modules/typescript/lib/tsc.js:64249:28)\r\n    at addOldTypeMetadata (/Users/jcullison/.config/yarn/global/node_modules/typescript/lib/tsc.js:64191:92)\r\n    at addTypeMetadata (/Users/jcullison/.config/yarn/global/node_modules/typescript/lib/tsc.js:64185:17)\r\n    at transformAllDecoratorsOfDeclaration (/Users/jcullison/.config/yarn/global/node_modules/typescript/lib/tsc.js:64104:13)\r\n    at generateClassElementDecorationExpression (/Users/jcullison/.config/yarn/global/node_modules/typescript/lib/tsc.js:64129:40)\r\n    at generateClassElementDecorationExpressions (/Users/jcullison/.config/yarn/global/node_modules/typescript/lib/tsc.js:64115:34)\r\n    at addClassElementDecorationStatements (/Users/jcullison/.config/yarn/global/node_modules/typescript/lib/tsc.js:64108:44)\r\n```\r\n**Playground Link:** [Provided](https://www.typescriptlang.org/play/?experimentalDecorators=true&emitDecoratorMetadata=true&target=6#code/JYWwDg9gTgLgBAIigUwGYBtkGMYFoTIwCGAJkcQgNwBQ1WEAdgM7yrQjkCyhp5RA0sgCecALxwAykJAAjCOgAUCNlA4wEAShrVUAVwY5gjOCrULT5CTCjAGAcwBccFjfsa4Ab2pw4KGLqgGOAAlNEwcADoCYjJic3YuHliBYQAaEwSYK1c7LWoAX1o9AxgjILtCADFMhWIoCpgnIgYhdLAoCDBkWCFBIScXW1zPb19CAKDQjGwYCIbuGL541UTF4j70uoa2jq6evrzC2ix0IiYmOABxFEJukZ8AAQsYJQAJZHR0CHSAUiZNUZ2G6lexOAAGcnOYLgAB84GDkOAvkJkMhoeIAOSIsDI1EY7Q+ejMay6HDQBQEc5ECpODGQpgY2FwLFIiAo5AY9xeHw+GAAC2ATDmwKGYjglKY1OQNB8hR8QNRLy5o0JjBYGRWWWsovEDWqmtqAqY6QQCsIQ00Mp5fgmGrU2SGERQOKIWGQSj+CE2RuFiqGeVlBWOavgdjFDGQAHcrsDugo6RBzpzqHZfYQFBogA)\r\n\r\nConsole output:\r\nError: Debug Failure. Unexpected node.\r\nNode NoSubstitutionTemplateLiteral was unexpected.\r\n\r\n**Related Issues:**\r\n(similar idea) https://github.com/microsoft/TypeScript/issues/37276\r\n\r\n**Example cli:***\r\n`tsc --outdir ./build --target ES2019 --experimentalDecorators -emitDecoratorMetadata ./test-param-decorator.ts`","author":{"url":"https://github.com/culli","@type":"Person","name":"culli"},"datePublished":"2020-05-08T20:24:12Z","url":"https://github.com/microsoft/TypeScript/issues/38428"}

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:b1b48998-3153-6db5-c8a1-cd3450470230
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9A5A:2564F:EC0C6B:137FF71:6B0101A6
html-safe-nonce56b0495aec7475c92d8529c9e7e7119d0c6c48658ff7288dcaea1acbbfc39a2e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTVBOjI1NjRGOkVDMEM2QjoxMzdGRjcxOjZCMDEwMUE2IiwidmlzaXRvcl9pZCI6Ijc5MjMxMjMzMDc0MzAzNDcxNzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacbe07e458177282a9edc466bc801894e80bc29ee6d52d4718f963252cabec9058
hovercard-subject-tagissue:614967373
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/38428/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e4e041a99b0f2f19069e7adb4e0c8e8537d8bc93ad29e79ec92201b4c5a760b5/microsoft/TypeScript/issues/38428
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e4e041a99b0f2f19069e7adb4e0c8e8537d8bc93ad29e79ec92201b4c5a760b5/microsoft/TypeScript/issues/38428
og:image:altThis is an edge case, but my team for various reasons decided to use template literals everywhere instead of strings. In almost all cases this seems to not have any drawbacks, except this case I'm ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameculli
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
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
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/38428#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F38428
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%2F38428
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/38428
Reloadhttps://github.com/microsoft/TypeScript/issues/38428
Reloadhttps://github.com/microsoft/TypeScript/issues/38428
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests309 (309)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/38428
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/38428
#39481https://github.com/microsoft/TypeScript/pull/39481
emitDecoratorMetadata combined with template literals throws exception and exitshttps://github.com/microsoft/TypeScript/issues/38428#top
#39481https://github.com/microsoft/TypeScript/pull/39481
https://github.com/weswigham
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
TypeScript 4.0.1https://github.com/microsoft/TypeScript/milestone/123
https://github.com/culli
Jim Cullison (culli)https://github.com/culli
on May 8, 2020https://github.com/microsoft/TypeScript/issues/38428#issue-614967373
Providedhttps://www.typescriptlang.org/play/?experimentalDecorators=true&emitDecoratorMetadata=true&target=6#code/JYWwDg9gTgLgBAIigUwGYBtkGMYFoTIwCGAJkcQgNwBQ1WEAdgM7yrQjkCyhp5RA0sgCecALxwAykJAAjCOgAUCNlA4wEAShrVUAVwY5gjOCrULT5CTCjAGAcwBccFjfsa4Ab2pw4KGLqgGOAAlNEwcADoCYjJic3YuHliBYQAaEwSYK1c7LWoAX1o9AxgjILtCADFMhWIoCpgnIgYhdLAoCDBkWCFBIScXW1zPb19CAKDQjGwYCIbuGL541UTF4j70uoa2jq6evrzC2ix0IiYmOABxFEJukZ8AAQsYJQAJZHR0CHSAUiZNUZ2G6lexOAAGcnOYLgAB84GDkOAvkJkMhoeIAOSIsDI1EY7Q+ejMay6HDQBQEc5ECpODGQpgY2FwLFIiAo5AY9xeHw+GAAC2ATDmwKGYjglKY1OQNB8hR8QNRLy5o0JjBYGRWWWsovEDWqmtqAqY6QQCsIQ00Mp5fgmGrU2SGERQOKIWGQSj+CE2RuFiqGeVlBWOavgdjFDGQAHcrsDugo6RBzpzqHZfYQFBogA
#37276https://github.com/microsoft/TypeScript/issues/37276
Jim Cullison (culli)https://github.com/culli
on May 9, 2020https://github.com/microsoft/TypeScript/issues/38428#event-3319761701
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
on Jun 5, 2020https://github.com/microsoft/TypeScript/issues/38428#event-3413423969
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Wesley Wigham (weswigham)https://github.com/weswigham
on Jun 5, 2020https://github.com/microsoft/TypeScript/issues/38428#event-3413424036
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.0https://github.com/microsoft/TypeScript/milestone/114
on Jun 5, 2020https://github.com/microsoft/TypeScript/issues/38428#event-3413424147
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.0https://github.com/microsoft/TypeScript/milestone/114
Typescript 4.0.1https://github.com/microsoft/TypeScript/milestone/123
on Jun 29, 2020https://github.com/microsoft/TypeScript/issues/38428#event-3493752091
Wesley Wigham (weswigham)https://github.com/weswigham
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Jul 7, 2020https://github.com/microsoft/TypeScript/issues/38428#event-3522474831
Wesley Wigham (weswigham)https://github.com/weswigham
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#39481https://github.com/microsoft/TypeScript/pull/39481
on Jul 7, 2020https://github.com/microsoft/TypeScript/issues/38428#event-3522561436
microsofthttps://github.com/microsoft
on Oct 21, 2025https://github.com/microsoft/TypeScript/issues/38428#event-20416958604
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/38428
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/38428
Wesley Wigham (weswigham)https://github.com/weswigham
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
TypeScript 4.0.1https://github.com/microsoft/TypeScript/milestone/123
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.