René's URL Explorer Experiment


Title: [BUG] Adding a decorator to a class inside a namespace causes assignation to undefined `___exports` · Issue #1634 · TypeScriptToLua/TypeScriptToLua · GitHub

Open Graph Title: [BUG] Adding a decorator to a class inside a namespace causes assignation to undefined `___exports` · Issue #1634 · TypeScriptToLua/TypeScriptToLua

X Title: [BUG] Adding a decorator to a class inside a namespace causes assignation to undefined `___exports` · Issue #1634 · TypeScriptToLua/TypeScriptToLua

Description: Description of the issue In my current project, I created a namespace that is split across different files with the goal of containing declarations of classes that I later declare as global, and make actually global using a decorator, as...

Open Graph Description: Description of the issue In my current project, I created a namespace that is split across different files with the goal of containing declarations of classes that I later declare as global, and ma...

X Description: Description of the issue In my current project, I created a namespace that is split across different files with the goal of containing declarations of classes that I later declare as global, and ma...

Opengraph URL: https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1634

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] Adding a decorator to a class inside a namespace causes assignation to undefined `___exports`","articleBody":"# Description of the issue\nIn my current project, I created a namespace that is split across different files with the goal of containing declarations of classes that I later `declare` as global, and make actually global using a decorator, as described [in the docs](https://typescripttolua.github.io/docs/assigning-global-variables#registering-classes-with-a-decorator).\nHowever, using a decorator produces, in the compiled files, an assignation to `___exports` as the last instruction of the namespace definition.\n\n# Reproduction\nAside from the declaration and definition of a simple decorator (aptly named `Decorator`), I've made two files which both add a class to a namespace (`Repro`).\n**`WithoutDecorator.ts`**\n```ts\nnamespace Repro {\n    export class  WithoutDecorator {}\n}\n```\n\n**`WithDecorator.ts`**\n```ts\nnamespace Repro {\n  @Decorator\n  export class WithDecorator {}\n}\n```\n\nHere's the produced lua for those files:\n**`WithoutDecorator.lua`**\n```lua\nlocal ____lualib = require(\"lualib_bundle\")\nlocal __TS__Class = ____lualib.__TS__Class\nRepro = Repro or ({})\ndo\n    Repro.WithoutDecorator = __TS__Class()\n    local WithoutDecorator = Repro.WithoutDecorator\n    WithoutDecorator.name = \"WithoutDecorator\"\n    function WithoutDecorator.prototype.____constructor(self)\n    end\nend\n```\n\n**`WithDecorator.lua`**\n```lua\nlocal ____lualib = require(\"lualib_bundle\")\nlocal __TS__Class = ____lualib.__TS__Class\nlocal __TS__Decorate = ____lualib.__TS__Decorate\nRepro = Repro or ({})\ndo\n    Repro.WithDecorator = __TS__Class()\n    local WithDecorator = Repro.WithDecorator\n    WithDecorator.name = \"WithDecorator\"\n    function WithDecorator.prototype.____constructor(self)\n    end\n    WithDecorator = __TS__Decorate(WithDecorator, WithDecorator, {Decorator}, {kind = \"class\", name = \"WithDecorator\"})\n    ____exports.WithDecorator = WithDecorator -- [editor's note]: throws \"attempt to index global '____exports' (a nil value)\"\nend\n```\n\nTo test it for yourself, you can download this minimal reproduction repo: https://github.com/SirWrexes/tstl-decorator-bug.\nA `run.lua` file is provided to set the `package.path` to see results of compilation (inside `./lua/`) and require the two compiled sources.\n```sh\nnpm install\nnpx tstl\nlua ./run.lua\n```\n\n# Expected behaviour\nThis assignation should not happen. Behaviour should not be different with and without a decorator on the classes inside a namespace.\nThe namespace itself is global, and it is not exported from its file, so the source rightly doesn't have a local named `___exports` to assign to.","author":{"url":"https://github.com/SirWrexes","@type":"Person","name":"SirWrexes"},"datePublished":"2025-05-24T00:13:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1634/TypeScriptToLua/issues/1634"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6ab4a8e7-298d-ad49-213b-0ea9f06d211c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9F24:38B1A1:B2BE9C:F1E0A8:69731E9D
html-safe-nonce6cc63696b41ad913bf44f9d546f929306a8c2542afcc99797ab688b1ffb52615
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjI0OjM4QjFBMTpCMkJFOUM6RjFFMEE4OjY5NzMxRTlEIiwidmlzaXRvcl9pZCI6IjU1MDc2NTI3NDcwNTYzMjkyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac7c4e0213cd2880ab4672458a2d163792f8ae4a84d7266dd01264d6b46e67f7d2
hovercard-subject-tagissue:3087757367
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/TypeScriptToLua/TypeScriptToLua/1634/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b467cbd5c35291165b2eec7886916936e5f2003b80c2d857dd3d78f44e4a8a2c/TypeScriptToLua/TypeScriptToLua/issues/1634
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b467cbd5c35291165b2eec7886916936e5f2003b80c2d857dd3d78f44e4a8a2c/TypeScriptToLua/TypeScriptToLua/issues/1634
og:image:altDescription of the issue In my current project, I created a namespace that is split across different files with the goal of containing declarations of classes that I later declare as global, and ma...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSirWrexes
hostnamegithub.com
expected-hostnamegithub.com
None44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4
turbo-cache-controlno-preview
go-importgithub.com/TypeScriptToLua/TypeScriptToLua git https://github.com/TypeScriptToLua/TypeScriptToLua.git
octolytics-dimension-user_id44121206
octolytics-dimension-user_loginTypeScriptToLua
octolytics-dimension-repository_id115876595
octolytics-dimension-repository_nwoTypeScriptToLua/TypeScriptToLua
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id115876595
octolytics-dimension-repository_network_root_nwoTypeScriptToLua/TypeScriptToLua
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
releasea5e2b48bd1260476599758f5d253b5d24092ab84
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/TypeScriptToLua/TypeScriptToLua/issues/1634#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTypeScriptToLua%2FTypeScriptToLua%2Fissues%2F1634
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTypeScriptToLua%2FTypeScriptToLua%2Fissues%2F1634
Sign up https://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=TypeScriptToLua%2FTypeScriptToLua
Reloadhttps://github.com/TypeScriptToLua/TypeScriptToLua/issues/1634
Reloadhttps://github.com/TypeScriptToLua/TypeScriptToLua/issues/1634
Reloadhttps://github.com/TypeScriptToLua/TypeScriptToLua/issues/1634
TypeScriptToLua https://github.com/TypeScriptToLua
TypeScriptToLuahttps://github.com/TypeScriptToLua/TypeScriptToLua
Please reload this pagehttps://github.com/TypeScriptToLua/TypeScriptToLua/issues/1634
Notifications https://github.com/login?return_to=%2FTypeScriptToLua%2FTypeScriptToLua
Fork 181 https://github.com/login?return_to=%2FTypeScriptToLua%2FTypeScriptToLua
Star 2.4k https://github.com/login?return_to=%2FTypeScriptToLua%2FTypeScriptToLua
Code https://github.com/TypeScriptToLua/TypeScriptToLua
Issues 138 https://github.com/TypeScriptToLua/TypeScriptToLua/issues
Pull requests 8 https://github.com/TypeScriptToLua/TypeScriptToLua/pulls
Actions https://github.com/TypeScriptToLua/TypeScriptToLua/actions
Wiki https://github.com/TypeScriptToLua/TypeScriptToLua/wiki
Security 0 https://github.com/TypeScriptToLua/TypeScriptToLua/security
Insights https://github.com/TypeScriptToLua/TypeScriptToLua/pulse
Code https://github.com/TypeScriptToLua/TypeScriptToLua
Issues https://github.com/TypeScriptToLua/TypeScriptToLua/issues
Pull requests https://github.com/TypeScriptToLua/TypeScriptToLua/pulls
Actions https://github.com/TypeScriptToLua/TypeScriptToLua/actions
Wiki https://github.com/TypeScriptToLua/TypeScriptToLua/wiki
Security https://github.com/TypeScriptToLua/TypeScriptToLua/security
Insights https://github.com/TypeScriptToLua/TypeScriptToLua/pulse
New issuehttps://github.com/login?return_to=https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1634
New issuehttps://github.com/login?return_to=https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1634
#1636https://github.com/TypeScriptToLua/TypeScriptToLua/pull/1636
[BUG] Adding a decorator to a class inside a namespace causes assignation to undefined ___exportshttps://github.com/TypeScriptToLua/TypeScriptToLua/issues/1634#top
#1636https://github.com/TypeScriptToLua/TypeScriptToLua/pull/1636
bughttps://github.com/TypeScriptToLua/TypeScriptToLua/issues?q=state%3Aopen%20label%3A%22bug%22
scope: transformationTransformation of TS to Luahttps://github.com/TypeScriptToLua/TypeScriptToLua/issues?q=state%3Aopen%20label%3A%22scope%3A%20transformation%22
https://github.com/SirWrexes
https://github.com/SirWrexes
SirWrexeshttps://github.com/SirWrexes
on May 24, 2025https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1634#issue-3087757367
in the docshttps://typescripttolua.github.io/docs/assigning-global-variables#registering-classes-with-a-decorator
https://github.com/SirWrexes/tstl-decorator-bughttps://github.com/SirWrexes/tstl-decorator-bug
bughttps://github.com/TypeScriptToLua/TypeScriptToLua/issues?q=state%3Aopen%20label%3A%22bug%22
scope: transformationTransformation of TS to Luahttps://github.com/TypeScriptToLua/TypeScriptToLua/issues?q=state%3Aopen%20label%3A%22scope%3A%20transformation%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.