* Add isolatedModules error for ambiguous imports referenced in decorator metadata
* Improve test and accept baselines
* Error only for es2015+
* Add namespace import to error message as workaround
* Add codefix
* Fix merge fallout
* Handle JS synthetic rest args in contextual parameter assignment
* Limit fixing to only unannotated js rest parameters
* Minimize test
* Add annotated version
* Remove explicit CheckFlags.RestParameter check since apparently not all rest parameters are CheckFlags.RestParameter
* Add moduleDetection compiler flag to allow for changing how modules are parsed
The default setting is 'auto', where JSX containing files under react-jsx and react-jsxdev are
always parsed as modules, and esm-format files under module: node12+ are always parsed as modules,
in addition to the 'legacy' detection mode's conditions for other files. (Declaration files are exempt from
these new conditions)
The 'legacy' mode preserves TS's behavior prior to the introduction of this flag - a file is
parsed as a module if it contains an import, export, or import.meta expression.
In addition, there is a 'force' mode that forces all non-declaration files to be parsed as modules.
(Declaration files are still only modules if they contain a top-level import or export.)
This technically breaks the parser API, but it's kinda-sorta backwards compatible so long
as you don't need the functionality associated with more recent compiler flags.
* Fix post-merge lint
* Rename function
* Update default value documentation
* PR feedback
* Fix lint and typo
* Fix conditional type type parameter leak
* Monkey with comment text per code review
* Conditionally clone type param
* Reuse input array and avoid making mapper where possible
* fix this type validations for protected fields
* update previous baselines
* add new tests and baselines
* ClassOrInterface can be returned as enclosingClass
* inline function code and remove unnecessary blank lines
* refactor enclosingClass checks
In short, the fix I submitted looked at the union ofproperties, but it
really should have looked at the intersection.
Two sytlistic notes. I couldn't find the best way to get the unique
strings of an array like `[...new Set()]` would, so I created a small
helper function, but didn't put it in a great place. Also, before the
second concatenated array of discriminators at least matched the first
in complexity, but now it's much worse. I don't think that section is
particularly easy to read, but I also don't see a significantly reusable
part.
fixes#41759
* Use full `isReadonlySymbol` check rather than declaration flags
* Limit subtype readonly consistency check to strict subtype relation
* Update comment
* fix issue where duplicate default exports aren't detected when there's an interface
* accept baseline change
* add `exportDefaultInterfaceClassAndValue` test
* add more tests for multiple default exports
* add two interfaces test
Co-authored-by: DetachHead <detachhead@users.noreply.github.com>
* Uncalled function checks only works with single conditional
* fix type errors in compiler
* remove uncalled function checks with negations
* review
* fix test
* Cleanup after merge, accept baselines
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* Permit type arguments in references to generic functions
* Accept new baselines
* Delete pointless fourslash test
* Fix lint issue
* Finalize implementation
* Add tests
* Accept new baselines
* Properly handle instantiation of instantiation expression types
* Accept new API baselines
* Fix lint error
* Add more tests
* Properly handle unions/intersections of generic types
* Add more tests
* More permissive parsing of type arguments in member expressions
* Update tests
* Accept new baselines
* Fix error term of declaration in modules
* fix test
* change error code of "An import declaration can only be used at the top level of a module."
* Separate js and ts files for export errors in module.
* Change non-top-level error in namespace
* format
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
* WIP: pass in checkmode to getNarrowableTypeForReference
* add tests
* another pass through new check mode argument
* rename new check mode
* only use rest flag for rest elements in objects
* add and update tests
* change check mode flag name
* restore package-lock.json
* fix comments
* get rid of fourslash tests
* fix caching in checkExpressionCached when checkMode is not normal
* Don't distinguish between object and array rest elements
* get rid of undefined check mode
* don't make includeOptionality into checkmode flag