* Passing --checkJs always sets --allowJS
Even if you have `"allowJs": false`. This is not a useful combination.
Changing this makes the compiler more friendly and easier to describe.
* only set allowjs if not explicitly set
* remove stray newline
* restore bad config error
* use an accessor function instead
* Fix crash intersecting dynamic import w/esModuleInterop
The dynamic import shim creates a symbol without some properties that
the intersection-creating code assumes are present as of #38673.
This PR adds the smallest possible set of properties to avoid the crash.
I'm not sure what others would be good to add.
* Use symbol's declarations instead
* Fix getResolvedMembersOrExportsOfSymbol instead
* comment from code review
* Don’t offer to extract export assignment
* Terminate unterminated literals when extracting them
* Add test with regular expression ending in backslash
* Add test for string literal ending in backslash
* Remove unused parameter default
When handling an array type, the lookup should use the position index
instead of the identifier name.
Also uncomment the tests in the `staticFieldWithInterfaceContext.ts`
test which failed because of this bug.
Fixes#40158.
The commonjs-specific code for resolving access expressions on `require`
assumes a fake commonjs export. For real exports, it needs to call
resolveSymbol since it's outside the normal alias-resolving
infrastructure.
From the user tests:
```js
const x = require('y').z.ka
```
would cause the crash because I forgot to call
getLeftMmostPropertyAccessExpression in one place.
Note that this doesn't fix the alias, it just stops the crash.
* Modify test harness so it can report underlying issue, fix small parent pointer issue
* Fix underlying export asignment check issue and fix lints
* Ensure class/function duplicate declaration errors are reported regarless of which is encountered first
* Ensure flag conflict errors are reported regardless of which declaration is encountered first
* First attempt at aliases for require
* test+initial support for const x=require
* 1st round of baseline improvements
* 2nd round of baseline updates
* support property access after require
* check @type tag on require
* forbid expando missing namespaces on aliases
taken from #39558 as soon as it was created
* accept error baselines that are good, actually
* Scribbling on d.ts emit code
* use getSpecifierForModuleSymbol
* hideous hack for module.exports of aliases
* Fix module.exports.x --> export list emit
* fix isLocalImport predicate
* require only creates aliases in JS
* re-handle json imports
* update fourslash baseline
* Cleanup in the checker
1. Simplify alias resolution.
2. Simplify variable-like checking.
3. Make binding skip require calls with type tags -- they fall back to
the old require-call code and then check from there.
I haven't started on the declaration emit code since I don't know what
is going on there nearly as well.
* Function for getting module name from require call
* First round of cleanup plus a new test
Found one missing feature, not sure it's worth adding.
* more small cleanup
* more cleanup, including lint
* use trackSymbol, not serializeTypeForDeclaration
* Code review comments, plus remove unneeded code
Ad-hoc type reference resolution for `require` isn't needed anymore.
* find all refs works
* remove old ad-hoc code
* make it clear that old behaviour is not that correct
* update api baselines
* remove outdated comment
* PR feedback
1. Fix indentation
2. Add comment for exported JSON emit
3. Add test case for nested-namespace exports.
* add a fail-case test (which passes!)
* Support recursive conditional types
* Accept new API baselines
* Accept new baselines
* Simplify recursive type tracking in type inference
* Accept new baselines
* Add tests
* Accept new baselines
* Revise recursion tracking in type inference
* Revise tests
* Accept new baselines
* Add more tests
* Accept new baselines