GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Definition flattening by weswigham · Pull Request #5332 · microsoft/TypeScript

Conversation

@weswigham

@weswigham Wesley Wigham (weswigham) commented Oct 20, 2015

Copy link
Copy Markdown
Member

This PR is based on #5090.

In #5090, we enable the concatenate of external modules when --outFile is paired with --module, and can create a concatenated ambient module declaration file to go with it.

This PR adds a new command line option, --optimizationEntrypoint (please give me better suggestions for the name, because eight syllables seems like too much). When passed alongside --outFile and --module, it is used to specify a file which is used as the entrypoint for optimizations to the .d.ts (and later potentially the js).

When supplied, it changes the declaration emit so that instead of a collection of ambient modules, it emits a single external module file with all types inlined - no import statements remain in the resulting dts file, and only those types which are reachable and visible by the entrypoint file's exported types are included. Name conflicts are handled with a renaming scheme whereby items with the same name get mangled to oldname_### when inlined. This, IMO, ended up resulting in a nicer dts file when there were many internal conflicts than attempting to partially preserve module structure with fake namespaces (and was substantially easier to emit).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bykbtzr, flekmatik, jukibom, Speedy37, milutinovici, kamranayub, and grovesNL reacted with thumbs up emoji
All reactions
  • 👍 7 reactions
Wesley Wigham (weswigham) added 30 commits October 8, 2015 15:18
@weswigham
plumbing to start
c5a353b
@weswigham
Merge branch 'master' into definition-flattening
380d881
@weswigham
exported types can get flattened now
719be34
@weswigham
ehhh... getting there
2ef2fc9
@weswigham
check member visibility for type visiting, use symbol id as key
cfcf245
@weswigham
Its messy, but type flattening it here
e57d37d
@weswigham
add a test case
ecf64ad
@weswigham
Merge branch 'out-module-concat' into definition-flattening
794bd92
@weswigham
Improve concatenated dts testing
4516af1
@weswigham
old test behaviuor presrved
0267d0f
@weswigham
okay, now tests with optimization entrypoint run correctly
b2047f5
@weswigham
_solid_ support for type flattening
8001249
@weswigham
export everything
7f218ab
@weswigham
fix lint, accept broken scoped baselines
9ac5fa8
@weswigham
start attempting to handle default exports
7802f22
@weswigham
handling defaults correctly, now for generics
b8d3d9c
@weswigham
refactor a bit
2d70da1
@weswigham
handle export assignments
483c7d9
@weswigham
more tests
68ae4b3
@weswigham
Type walk is pretty beatuiful now, still not exporting aliases right,…
3625990
… though
@weswigham
i now know whye everyone hates self referential type aliases
8a04d40
@weswigham
changeup traversal a bit, still cant do aliases or type queries right
b08dc4e
@weswigham
We now find higher level declarations for nested types so typeof expr…
818b89b
…essions resolve
@weswigham
move comments
2e1bcce
@weswigham
break early on export =, not that there should be toher declarations
0d6c194
@weswigham
Fix things, awwww yis
066ffa9
@weswigham
collect declarations to begin with, rather than types
4d66987
@weswigham
re-correct the name mangling of default exports
93eee77
@weswigham
lint fixes
39abdb6
@weswigham
accept new test baselines
63a9673
Wesley Wigham (weswigham) added 15 commits October 21, 2015 17:06
@weswigham
use side table for identifiers
ef5075b
@weswigham
derive import equals name from module name
cc7a734
@weswigham
Merge branch 'out-module-concat' into definition-flattening
197028c
@weswigham
fixup the bits, add another test, and accpt the new baselines
e6b1ae8
@weswigham
typeWalker -> symbolWalker, handle type queries better
5d6b1d5
@weswigham
Accept new baseline
439bb9e
@weswigham
Merge branch 'out-module-concat' into definition-flattening
06eea16
@weswigham
comma
608955a
@weswigham
Merge branch 'out-module-concat' into definition-flattening
e77a05a
@weswigham
semicolong
dbb913e
@weswigham
Merge branch 'out-module-concat' into definition-flattening
49fe17a
@weswigham
Merge branch 'out-module-concat' into definition-flattening
60fb963
@weswigham
Merge branch 'out-module-concat' into definition-flattening
74db034
@weswigham
add back in methods
f354b91
@weswigham
fix with changes since merge, accept new baselines
f17efbd
@mhegazy Mohamed Hegazy (mhegazy) mentioned this pull request Jan 6, 2016
Proposal: Bundling TS module type definitions #4433
Closed
@ffMathy

Mathias Lykkegaard Lorenzen (ffMathy) commented Jan 6, 2016

Copy link
Copy Markdown

Any status on this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jamiewinder

Jamie Winder (jamiewinder) commented Jan 10, 2016

Copy link
Copy Markdown

This would be huge for porting libraries to TypeScript. We have all of the pieces for bundling projects together, but of course the main benefit of TypeScript are the types. Definitely hoping to see this soon, even if only a test version.

Quick question; I've been trying to use dts-generator, but it complains if I have external types in my signatures (e.g. returning a JQuery instance) and try to exclude them. By default it also bundles these in with the dts which is not at all desirable.

How will this be handled once it is supported by TypeScript? Thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gulbanana

gulbanana commented Jan 19, 2016

Copy link
Copy Markdown

really looking forward to this feature. in practice modules are bundled together by tools like webpack or browserify regardless of whether they're typescript, but definition bundling will be a unique point that allows supplying a library or package's types alongside it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@shanewho

Shane (shanewho) commented Feb 8, 2016

Copy link
Copy Markdown

I'd really like to have this. 👍

aluanhaddad, kamranayub, and simonsarris reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@david-driscoll David Driscoll (david-driscoll) mentioned this pull request Mar 17, 2016
Missing Definition file for UMD module ReactiveX/rxjs#1481
Closed
@kamranayub

Kamran Ayub (kamranayub) commented Dec 22, 2016

Copy link
Copy Markdown

This has been open for almost a year, would be great to finish this off--looking to use this right away ;)

simonsarris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kwonoj OJ Kwon (kwonoj) mentioned this pull request Dec 27, 2016
Single file typescript declarations for latest v5.0.2 ReactiveX/rxjs#2221
Closed
@kamranayub Kamran Ayub (kamranayub) mentioned this pull request Dec 29, 2016
Switch to new ES6 style modules in Excalibur excaliburjs/Excalibur#606
Closed
@mhegazy

Mohamed Hegazy (mhegazy) commented May 22, 2017

Copy link
Copy Markdown
Contributor

This is fairly stale by now. closing.

rossipedia and Nosfistis reacted with thumbs down emoji
All reactions
  • 👎 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhegazy Mohamed Hegazy (mhegazy) closed this May 22, 2017
@gulbanana

gulbanana commented May 23, 2017

Copy link
Copy Markdown

:(

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rossipedia

rossipedia (rossipedia) commented May 25, 2017

Copy link
Copy Markdown

screw that, I need this. I'll take it over if Wesley Wigham (@weswigham) is done with it

kamranayub, mateubo, and NaridaL reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@weswigham

Wesley Wigham (weswigham) commented May 25, 2017

Copy link
Copy Markdown
Member Author

There's a good chance this can be more elegantly reimplemented using the transform pipeline now that we have that. But was this just closed because it was stale, or because the feature is no longer desired (as a team member never requested a refresh AFAIK)?

tclift reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

10 participants

@weswigham @DanielRosenwasser @ffMathy @jamiewinder @gulbanana @shanewho @kamranayub @mhegazy @rossipedia @msftclas
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.