* Swap `forEachChild` to use an array of functions instead of a `switch` statement.
* Let's see if 'new' changes anything.
* Co-locate each assignment into `forEachChildTable`.
* Try `push`ing undefined to create a packed Array.
* Try using an unconditional no-op function.
* `forEach` -> `forEachChildIn`
* Remove the optional chain if we are pre-filling with no-ops.
* Grab function directly to avoid possible `.call` overhead from downlevel emit.
* Swap to object literal.
* Lints and formatting.
* Change type of deprecated 'decorators' property
* fix 'Invalid Arguments' error for create/update constructor in factory
* Update deprecation comments
* Make 'decorators' optional and 'undefined'
* Rename '_decorators' to 'illegalDecorators'
* Update baselines
* Report aggregate statistics for solution as well as some solution perf numbers
This change under --extendedDiagnostics aggregates the diagnostics from all projects built and reports it at the end. Apart from that it also outputs some measurements for work that happens in tsc --build like finding if projects are uptodate etc.
Also removes unnecessary node count per suggestion
* Apply suggestions from code review
Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
* Fix condition
* Remove extra time
Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
* Use binary search in file system cache
Previously, we were linear searching a linear number of times, resulting in too many `toLowerCaseFileName` calls on Windows.
* Use SortedArray types for clarity
* Use insertSorted after making it return a flat
* Drop redundant undefined
* Correct copy-paste error
* Merge multiple symbols even when re-exported
As far as I remember, the target of `mergeSymbol` needs to be a merged
symbol, not a symbol with a mergeId that points to mergedSymbol.
However, mergeSymbolTable didn't check for this.
I can't remember if symbol tables may contain
symbols-with-mergeId. If they can, then mergeSymbolTable needs to call
getMergedSymbol on the individual targets of the merge. That's what I
did in this PR.
* Call getMergeSymbol eagerly
On the source, not target, of mergeSymbolTable's contents
* Fixed a false positive related to binding patterns and spread expressions
* Improve ancestor lookup when checking if an expression is spread into an object
* Fixed ancestor lookup for more node types
* Remove equality check for contextual types
* Reformat code
* Use `isWithinSpreadAssignment` flag + `objectsWithinSpread` cache instead of ancestor traversal
* Revert "Use `isWithinSpreadAssignment` flag + `objectsWithinSpread` cache instead of ancestor traversal"
This reverts commit be387e3bbf8a5cce2bc4c31fd77b061ea6cf8e0b.
* Expand on the existing comment
* Update error messages for CJS imports resolving to ES modules
* Update error message
* Use package scope from source file
* Update baselines
* Issue error for JSX/TSX files
* Switch from related info to message chain
* Add test where clearing affected files watcher that also is shared by real path causes Debug failure
* Ensure that file watcher is closed only once for affected file locations that share watcher because of different names but same real path
* Lift up package json map
* Write a test and a huge comment
* Finish fixing everything
* Clean up comment
* Remove obsolete comment
* Fix comment trailing off
* Optimize to hit the file system much less
* Add test where module resolution cache is not local and hence doesnt report errors in watch mode
* Ensure module resolution cache is passed through in watch mode
* Remove unnecessary setting of impliedFormat which should anyways be done as part of create source file
* Add test for packge.json changing and modifying implied format
* Distinguish between package.json watch and affecting file location watch
* Pass in failed lookup and affected file locations for source file's implied format
Also stop creating options if we already have them
* Add diagnostic for explaining file's implied format if based on package.json
* Watch implied format dependencies for modules and schedule update on change
* For program if implied node format doesnt match create new source file. Handle implied node format in document registry
Fixes#50086
* Modify tests to show package.json being watched irrespective of folder its in
* Check file path if it can be watched before watching package.json file
* Because we are watching package.json files and failed lookups its safe to invalidate package json entries instead of clearing them out everytime program is created
* Remove todos
* Fix the incorrect merge
* Pickup PackageJsonInfo renames from #50088
* Rename
* Improve import type support for commonjs exports
This PR makes getTypeFromImportTypeNode a little more like
getExternalModuleMember: for JS files, it now uses both
`getTypeOfSymbol` and `getExportsOfSymbol`, and uses whichever one
returns a symbol. This allows using arbitrary properties of a CJS export=
as types in JSDoc; previously a special case in the binder enabled only
CJS export= where all properties were shorthand assignments.
Fixes#49195
* Add js types/value test case
* Improve binding of CJS property assignments
1. Bind property assignments same as shorthand property assignments in
module.exports object literal assignments.
2. Bind all such assignments, even if the object literal contains
non-property assignments. This is different from before, and it requires
slightly smarter code to prefer aliases when checking CJS imports.
* Remove new binder code
Just include the original fix
* revert missed type in binder
* Add test where the errors are reported in different file
Test for #49739
* Report error only on local declaration with additional related information
Fixes#49739
* Handle existing tests