Open ernestostifano opened 1 year ago
I am not aware of any semantic difference in the order of references
.
It looks like TypeScript docs does not mention it.
However, I think it makes sense to topological sort the elements of references
.
Currently, references
is not sorted. This change will make it more stable (but this is a BREAKING CHANGE).
๐ old lerna has --sort
option, but it will be removed. I don't think it's worth much to make it an option.
๐ moon has same feature for TypeScript project references. It may be worth looking into what sorting MOON does.
Hi guys, I was wondering if it wouldn't be that complicated to add an option to sort references using a dependent-upon logic instead of an alphabetical one (especially in the root
tsconfig
file).By dependent-upon logic I mean for packages that are dependencies for other packages to appear first in the lists.
I assume you already have the required information since you need to resolve the dependency graph to create the references.
My proposal is motivated by this issue: https://github.com/typescript-eslint/typescript-eslint/issues/2094#issuecomment-1564719858
I know that it is some sort of edge case, but I think that this sorting logic could be of more value than the alphabetical one (which can be easily obtained at a latter time).
My intention is to import my
tsconfig
file and use the references list. This way I don't need to keep a separate list of dependencies with this particular order elsewhere.Cheers.