* Test showing the moduleResolutionCache reset issue with tsc --b --w
* Fix incorrect usage of ownMap by making it function returning ownMap instead of constant value
* Improve errors for incorrectly nested export default
The compiler and services don't handle incorrectly nested
`export default` well right now:
```ts
export = (x,y) => {
export default { }
}
```
Asking for document highlights, find all references or quick info on
'export' or 'default' cause a crash. After the crash is fixed, the error
message is confusing and wrong: "An export assignment cannot be used outside a module."
This PR:
1. Skips document highlights for incorrectly nested export default.
2. Skips find all refs for incorrectly nested export default.
3. Switches the fallback binding for incorrectly nested export default
from Alias to Property. Neither is correct, but Property doesn't cause a
crash in alias resolution.
4. Improves the error message to reflect a post-ES module world, which
has export default and 'module' means 'ES module', not 'namespace'.
Fixes#40082 and the related bugs mentioned above.
* address PR comments
PR #42556 was a nice optimization that dramatically sped up comparisons of discriminated unions. Unfortunately, the cost of determining whether a union is discriminated can be prohibitively high. In particular, an internal team with a very large repo saw their type count double and their memory usage increase from 6GB to 9GB, breaking their build. This changes splits the difference by not trying to compute the property types of intersection types - a notoriously slow operation.
* Fix package.json auto imports for pnpm without project references
* Make property optional
* Revert unnecessary unnittest change
* Set symlinked files when setting symlinked directories
* Update `typeDirectiveIsEqualTo`
* Consider symlinks found during type reference directive resolution into `discoverProbableSymlinks`
* Rename `originalFileName` to `originalPath`, make internal
* Allow filterType to consider union constraints of non-union types when determining never-ness
* Move impl to callback
* Baseline change in narrowing behavior into test, fix post-LKG build
* Test where allowJs present in referenced project affects picking up right set of import files
* use options from referened project for including resolved imports in the file when using sources of project reference
Fixes#43909
Previously, the name resolution for link tags in displaypart generation
mistakenly required a valueDeclaration. Now it uses the first
declaration if there is no valueDeclaration, so that types and
namespaces will also resolve.
This is another instance of using valueDeclaration as "the default
declaration", which doesn't apply to types.
Fixes#43868
* Test where relative import isnt ideal in the declaration emit
* use project relative preference for declaration emit
Fixes#39117
* Fix incorrect path matching when calculating module specifier
* Use correct baseUrl for the module specifier
* Handle localness in special cases by checking exported variable assignment
Fixes#42976
* Fix existing tests where arrow now behaves similar to function expression
* Update src/services/goToDefinition.ts
Previously, getExternalModuleMember passed through its received value of
`dontResolveAlias` to every function that accepted it. That includes (1)
resolution of the module symbol and (2) resolution of the module
specifier. However, in TS, the module symbol is never an alias anyway, so
dontResolveAlias doesn't make a difference. In JS, the module symbol
*can* be an alias, and it should always be resolved. That's what this PR
does.
Fixes#43713
* Scribbles + tests
The second test actually requires node types
* Basically working
The two simple fixes, in arity error reporting, are in, and the
simplification of arity error reporting is half-done. I haven't started
on any improvements to call assignability.
* trim out too-real test case
* Finish cleanup
And reword error a little.
* Simplify and reword spread errors
* handle spreads first
* update baselines
* Address PR comments
* Complete `constructor` keyword after property declaration.
* Fix logical errors.
* Fix for more universal situations.
* Only provide completions if property declaration is terminated.
* Simplify many logical conditions.
* Make the fix more reliable.
* Narrowing the fix.
* Allow `override` as parameter property
* Update other baseline
* Add test for override on normal parameter
* Copy typo fix
* Update baselines
* Update API baseline
* Relate non-augmenting array subtypes without resorting to structural comparison
* Fix lint
* Generalize performance enhancement
* Cache results, feed through via getNormalizedType to remove error intermediates
* Use newly freed up object flags to limit member setting, fix crash with those object flags
* Move flags because there is no TypeFlags.Reference 🤦
* Fix completions of exports elsewhere in same file
* Undo messing up JSDoc-annotated module.exports assignments
* Add other failing contextual type test
* Rearrange contextual type logic for special assignments
* Rename helper function
This diff extends the types checked by
discriminateContextualTypeByObjectMembers and
discriminateContextualTypeByJSXAttributes to also include any optional
components in the type union.
fixes#41759 although it doesn't address the better error reporting for
their last repro, which I'm not sure how to address.