Title: Proposal: decouple emit/emitDeclarations from the source text · Issue #9147 · microsoft/TypeScript · GitHub
Open Graph Title: Proposal: decouple emit/emitDeclarations from the source text · Issue #9147 · microsoft/TypeScript
X Title: Proposal: decouple emit/emitDeclarations from the source text · Issue #9147 · microsoft/TypeScript
Description: TypeScript Version: nightly (1.9.0-dev.20160217) Use case: We are improving the coverage of ts-api-guardian which scans a public api surface exposed via a single entry point and serializes it for later comparison. The idea to improve the...
Open Graph Description: TypeScript Version: nightly (1.9.0-dev.20160217) Use case: We are improving the coverage of ts-api-guardian which scans a public api surface exposed via a single entry point and serializes it for l...
X Description: TypeScript Version: nightly (1.9.0-dev.20160217) Use case: We are improving the coverage of ts-api-guardian which scans a public api surface exposed via a single entry point and serializes it for l...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/9147
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Proposal: decouple emit/emitDeclarations from the source text","articleBody":"**TypeScript Version:** \n\nnightly (1.9.0-dev.20160217)\n\n**Use case:**\n\nWe are improving the coverage of [ts-api-guardian](https://github.com/angular/ts-api-guardian) which scans a public api surface exposed via a single entry point and serializes it for later comparison. The idea to improve the coverage is to serializing the public api surface into text output compatible with `.d.ts` file format. \n\nFor example, given\n\n``` typescript\n// a.ts\nexport class A { p: number; }\n\n// index.ts\nexport * from './a';\n```\n\nwe want to create a file with\n\n``` typescript\n// index.d.ts\nexport class A { p: number; }\n```\n\nTo do this, we'd like to reuse as much of the declaration emitter from typescript as possible so that we are in sync as new access modifiers, built-in types and symbol flags are added to typescript.\n\nOne approach we tried was to create collect all exported symbols, create corresponding synthesized nodes for them and then emit the declaration file for this AST, thus reusing existing `emitDeclarations` function. However this function is tightly coupled to the underlying SourceFile and uses the source text to output identifiers and types. As a result, calling `emit` on a synthesized SourceFile (without source text) gives something like:\n\n``` typescript\nexport class { : ; }\n```\n\nWould it be possible to either have\n1. Typescript exposes functions to emit a declaration string for for individual module exports; or\n2. `emitDeclarations` work with synthesized nodes (without source text).\n#5595 seems related (we could transform the AST to inline all the reexports), but does not account for the declaration emitter.\n","author":{"url":"https://github.com/jasonchoimtt","@type":"Person","name":"jasonchoimtt"},"datePublished":"2016-06-13T21:59:19Z","url":"https://github.com/microsoft/TypeScript/issues/9147"}
| 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:99d07deb-a413-89ab-fba1-c7f54f1482bf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8862:683FF:B9A47D:EFE836:6B00E9D5 |
| html-safe-nonce | ed999b4be69052304a07b4363f757f72dc156b9ad3e6383113b60d93ad33d1bf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODYyOjY4M0ZGOkI5QTQ3RDpFRkU4MzY6NkIwMEU5RDUiLCJ2aXNpdG9yX2lkIjoiMjUzMjk2ODUzOTU0ODA4NDY5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | af709b5240621ba141b0c5abb7a33978900673f4251aa81ef990b2f566fb8124 |
| hovercard-subject-tag | issue:160054647 |
| 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/9147/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d159d25b0448e606d76716547ec1a24eb5e6edbfcb441e6d668a4c1924a36ef3/microsoft/TypeScript/issues/9147 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d159d25b0448e606d76716547ec1a24eb5e6edbfcb441e6d668a4c1924a36ef3/microsoft/TypeScript/issues/9147 |
| og:image:alt | TypeScript Version: nightly (1.9.0-dev.20160217) Use case: We are improving the coverage of ts-api-guardian which scans a public api surface exposed via a single entry point and serializes it for l... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jasonchoimtt |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width