Title: Any file name with `.d.` in it ending with `.ts` is a declaration file in 5.0.2 even without `--allowArbitraryExtensions` · Issue #53319 · microsoft/TypeScript · GitHub
Open Graph Title: Any file name with `.d.` in it ending with `.ts` is a declaration file in 5.0.2 even without `--allowArbitraryExtensions` · Issue #53319 · microsoft/TypeScript
X Title: Any file name with `.d.` in it ending with `.ts` is a declaration file in 5.0.2 even without `--allowArbitraryExtensions` · Issue #53319 · microsoft/TypeScript
Description: TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Any file name with `.d.` in it ending with `.ts` is a declaration file in 5.0.2 even without `--allowArbitraryExtensions` · Issue #53319 · microsoft/TypeScript
Open Graph Description: TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Any file name with `.d.` in it ending with `.ts` is a declaration file in 5.0.2 even without `--allowArbitraryExte...
X Description: TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Any file name with `.d.` in it ending with `.ts` is a declaration file in 5.0.2 even without `--allowArbitraryExte...
Opengraph URL: https://github.com/microsoft/TypeScript
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Any file name with `.d.` in it ending with `.ts` is a declaration file in 5.0.2 even without `--allowArbitraryExtensions`","articleBody":"# Bug Report\r\n\r\nSee the last \"or\" condition:\r\n\r\nhttps://github.com/microsoft/TypeScript/blob/a70c4095dbf9a6f089738778487352afa1205d30/src/compiler/parser.ts#L10178-L10180\r\n\r\nAdded as part of #51435 -- I think this was meant to be behind the `--allowArbitraryExtensions` flag?\r\n\r\n```\r\n> function checkAmbient(fileUrl) {\r\n const s = ts.createSourceFile(fileUrl, \"\");\r\n console.log((s.flags & ts.NodeFlags.Ambient) === ts.NodeFlags.Ambient)\r\n}\r\nundefined\r\n> ts.version\r\n'5.0.2'\r\n> checkAmbient(\"file:///V:/test.d.ts$22-28.ts\")\r\ntrue\r\n> checkAmbient(\"file:///V:/test.d.tsblah.ts\")\r\ntrue\r\n> ts.version\r\n'4.9.5'\r\n> checkAmbient(\"file:///V:/test.d.ts$22-28.ts\")\r\nfalse\r\n> checkAmbient(\"file:///V:/test.d.ts22-28.ts\")\r\nfalse\r\n```\r\n\r\nRight now the only way I see to set if a file type is ambient is through the extension. Maybe the API needs a better way for consumers to tell it \"this is a declaration file\"? Maybe on `CreateSourceFileOptions`? Then perhaps the code that does the arbitrary extension resolution could mark the declaration file that matches the arbitrary extension as ambient and the code here could be reverted.\r\n\r\n### 🔎 Search Terms\r\n\r\nextension declaration\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- 5.0.2\r\n- I see this in main\r\n\r\n### 🙁 Actual behavior\r\n\r\nDeclaration file specific errors\r\n\r\n### 🙂 Expected behavior\r\n\r\nNo declaration file errors.\r\n","author":{"url":"https://github.com/dsherret","@type":"Person","name":"dsherret"},"datePublished":"2023-03-17T16:31:08Z","url":"https://github.com/microsoft/TypeScript/issues/53319"}
| 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 | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:e77ca55d-63b0-cb30-db6a-402f057f24c7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E9FA:B1B84:2BF5DA:37DDC0:6B0101BD |
| html-safe-nonce | a8f48beb215c140dbc0e3058fe8a3fd6b34fef39857fb6c57224b4a02bf39e32 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOUZBOkIxQjg0OjJCRjVEQTozN0REQzA6NkIwMTAxQkQiLCJ2aXNpdG9yX2lkIjoiMzY0NjY5NjgwOTcyMTU2MTUzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c1af55d7981ce5f6bddb4c60a0a44bef1c2389b933fb07a45b691c9fb16c5ac5 |
| hovercard-subject-tag | repository:20929025 |
| 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/microsoft/TypeScript/issues/53319 |
| twitter:image | https://opengraph.githubassets.com/e15f464ad8bbc0886f9cd391ce162cf993e58707e2cc6a0d2b7f905bfb541c3b/microsoft/TypeScript |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e15f464ad8bbc0886f9cd391ce162cf993e58707e2cc6a0d2b7f905bfb541c3b/microsoft/TypeScript |
| og:image:alt | TypeScript is a superset of JavaScript that compiles to clean JavaScript output. - Any file name with `.d.` in it ending with `.ts` is a declaration file in 5.0.2 even without `--allowArbitraryExte... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-cache |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width