* navigateTo: Collect results from all referenced projects.
* Don't use project references, just source maps
* Move more code to session
* Test when implementation file is deleted
* Use tsserver tests instead of fourslash tests to ensure session is used
* Support find-all-references
* Restore fourslash tests
* Update emit baselines (added missing newline)
* Support rename
* @weswigham code review
* Don't open/close files
* Avoid growing `toDo` too eagerly
* @sheetalkamat code review
* Also get symlinked projects for originalLocation
* Update API (#24966)
* More @sheetalkamat code review
* Remove unnecessary test
* Update API (#24966)
* Adds related spans and error grouping for duplicate identifier errors
* Trim trailing whitespace
* Record related info in error baselines
* Make error more whimsical
* Multifaceted approach to performantly enabling fileExists outside of the synchronize step in the emit host
* make cache undefinable and handle correctly
* Remove unneeded cast
* Readd assert
* More useful failure messager
* Generate normal 1-part sourcemaps (at increased processing cost), since tools dislike sectional ones
* Add semicolon
* Accept sad baselines]
* Forward along sourcesContent if available
* Supress lint since the API actually calls for null here
* Fix concatenated sourcemap paths
* Accept bad baselines :(
* Add overloads
* Accept api update
* Fix lint
* Use more nodelike paths for import types when possible
* move functionality from services into compiler, fix with propert file/directory conflict handling
* mark suspect cast
* Enable '--strictNullChecks'
* Fix API baselines
* Make sys.getEnvironmentVariable non-nullable
* make properties optional instead of using `| undefined` in thier type
* reportDiagnostics should be required
* Declare firstAccessor as non-nullable
* Make `some` a type guard
* Fix `getEnvironmentVariable` definition in tests
* Pretend transformFlags are always defined
* Fix one more use of sys.getEnvironmentVariable
* `requiredResponse` accepts undefined, remove assertions
* Mark optional properties as optional instead of using `| undefined`
* Mark optional properties as optional instead of using ` | undefined`
* Remove unnecessary null assertions
* Put the bang on the declaration instead of every use
* Make `createMapFromTemplate` require a parameter
* Mark `EmitResult.emittedFiles` and `EmitResult.sourceMaps` as optional
* Plumb through undefined in emitLsit and EmitExpressionList
* `ElementAccessExpression.argumentExpression` can not be `undefined`
* Add overloads for `writeTokenText`
* Make `shouldWriteSeparatingLineTerminator` argument non-nullable
* Make `synthesizedNodeStartsOnNewLine` argument required
* `PropertyAssignment.initializer` cannot be undefined
* Use one `!` at declaration site instead of on every use site
* Capture host in a constant and avoid null assertions
* Remove few more unused assertions
* Update baselines
* Use parameter defaults
* Update baselines
* Fix lint
* Make Symbol#valueDeclaration and Symbol#declarations non-optional to reduce assertions
* Make Node#symbol and Type#symbol non-optional to reduce assertions
* Make `flags` non-nullable to reduce assertions
* Convert some asserts to type guards
* Make `isNonLocalAlias` a type guard
* Add overload for `getSymbolOfNode` for `Declaration`
* Some more `getSymbolOfNode` changes
* Push undefined suppression into `typeToTypeNodeHelper`
* `NodeBuilderContext.tracker` is never `undefined`
* use `Debug.assertDefined`
* Remove unnecessary tag
* Mark `LiteralType.freshType` and `LiteralTupe.regularType` as required
* Type side of import types
* Value side of import types
* Accept library changes
* Refined implementation, more tests
* Allow resolutions to be performed late if the resolution still results in a file already in the build
* Add another test case
* Add some jsdoc usages
* Allow nodebuilder to use import types where appropriate
* Parse & check generic instantiations
* use import types in nodebuilder for typeof module symbols
* Wire up go to definition for import types
* Accept updated type/symbol baselines now that symbols are wired in
* PR feedback
* Fix changes from merge
* Walk back late import handling
* Remove unused diagnostic
* Remove unrelated changes
* Use recursive function over loop
* Emit type arguments
* undo unrelated change
* Test for and support import type nodes in bundled declaration emit
* Add compiler option to enable declaration sourcemaps
* Transparent goto definition for sourcemapped declaration files
* Post-rebase touchups
* Rename API methods
* Fix lints
* Fix typo in name XD
* Log sourcemap decode errors
* Share the cache more, but also invalidate it more
* Remove todo
* Enable mapping on go to implementation as well
* Allow fourslash to test declaration maps mroe easily
* more test
* Handle sourceRoot
* Add tests documenting current behavior with other sourcemapping flags
* Ignore inline options for declaration file maps, simplify dispatch in emitter
* Change program diagnostic
* Fix nit
* Use charCodeAt
* Rename internal methods + veriables
* Avoid filter
* span -> position
* Use character codes
* Dont parse our sourcemap names until we need to start using them
* zero-index parsed positions
* Handle sourceMappingURL comments, including base64 encoded ones
* Unittest b64 decoder, make mroe robust to handle unicode properly
* Fix lint
* declarationMaps -> declarationMap
* Even more feedback
* USE Mroe lenient combined regexp
* only match base64 characters
* Fix nit
The diagnostics reporting and expression resolution caching is quite intermingled at present.
Hence when we tried to get the declaration output without getting diagnostics, the resolution for functions return expression is cached but errors arent reported
Symbols arent marked as referenced. So at later time when trying to get the diagnostics since the expression resolution is cached, it doesnt even go through all checks
For now get diagnostics irrespective of declaration only output to avoid this issue.
Fixes#21518
* Integrate importStar and importDefault helpers
* Accept baselines
* Support dynamic imports, write helpers for umd module (and amd is possible) kinds
* Accept baselines
* Support AMD, use same helper initialization as is normal
* update typechecker to have errors on called imported namespaces and good error recovery with a quickfix
* Overhaul allowSyntheticDefaultExports to be safer
* Put the new behavior behind a flag
* Rename strictESM to ESMInterop
* ESMInterop -> ESModuleInterop, make default for tsc --init
* Rename ESMInterop -> ESModuleInterop in module.ts, add emit test (since fourslash doesnt do that)
* Remove erroneous semicolons from helper
* Reword diagnostic
* Change style
* Edit followup diagnostic
* Add secondary quickfix for call sites, tests forthcoming
* Add synth default to namespace import type, enhance quickfix
* Pair of spare tests for good measure
* Fix typos in diagnostic message
* Improve comment clarity
* Actually accept the updated changes to the esmodule interop description
* ESModule -> esModule
* Use find and not forEach
* Use guard
* Rely on implicit falsiness of Result.False
* These should have been emit flags
Timestamps look like Gulp's, with grey times inside white brackets.
Files have cyan filenames, yellow line and column numbers, and grey TS{####} errors. I wonder if those are actually useful for folks using the --pretty CLI: are they used for anything outside Visual Studio... Can we just get rid of them?
Re-uses compiler/program's color logic in compiler/watch. The relevant variables are now exported and marked `@internal`. Is there a preferred way of re-using this code in both those files?
This allows reporting of semantic errors as well. Semantic errors are
likely to outnumber syntactic errors, so it's valuable not to block
semantic errors on a few syntactic errors.
* Add utility function to check for strict option flags
- Correctelly check for noImplicitAny in checker
- Correctelly check for noImplicitAny in installTypesForPackage refactor
* Respond to code review comments
* Accept baselines
* Revert "Accept baselines"
This reverts commit cf4ef62830.
* Move type alias to core
This marks files reused correctly as from external library resulting in not using them for files to be emitted and computed for output structure
Fixes#19327
* Actually support baselining pretty in the harness
* Test case from 18216
* Use host newline in formatDiagnosticsWithColorAndContext
* Merge statements
* For duplicate source files of the same package, make one redirect to the other
* Add reuseProgramStructure tests
* Copy `sourceFileToPackageId` and `isSourceFileTargetOfRedirect` only if we completely reuse old structure
* Use fallthrough instead of early exit from loop
* Use a set to efficiently detect duplicate package names
* Move map setting outside of createRedirectSourceFile
* Correctly handle seenPackageNames set
* sourceFileToPackageId -> sourceFileToPackageName
* Renames
* Respond to PR comments
* Fix bug where `oldSourceFile !== newSourceFile` because oldSourceFile was a redirect
* Clean up redirectInfo
* Respond to PR comments
* Add 'name' property to Identifier
* Rename to unescapedText
* Rename 'id.text' to 'id.escapedText'
* Rename 'id.unescapedText' to 'id.text'
* Make escapeIdentifier and unescapeIdentifier do nothing
* Created a branded type for escaped strings
Then flowed it throughout the compiler, finding and fixing a handful of
bugs relating to underscore-prefixed identifiers in the process.
Includes a test for two cases noticed - diagnostics from conflicting
symbols from export *'s, and enum with underscore prefixed member emit.
* Correctly double underscores WRT mapped types
* Add fourslash tests for other fixed issues
* use function call over cast
* Update forEachEntry type accuracy
* Just use escaped names for ActiveLabel
* Remove casts from getPropertyNameForPropertyNameNode
* This pattern has occurred a few times, could use a helper function.
* Remove duplicated helper
* Remove unneeded check, use helper
* Identifiers list is no longer escaped strings
* Extract repeated string-getting code into helper
* Rename type and associated functions
* Make getName() return UnderscoreEscapedString, add getUnescapedName()
* Add list of internal symbol names to escaped string type to cut back on casting
* Remove outdated comments
* Reassign interned values to nodes, just in case
* Swap to string enum
* Add deprecated aliases to escapeIdentifier and unescapeIdentifier
* Add temp var
* Remove unsafe casts
* Rename escaped string type as per @sandersn's suggestion, fix string enum usages
* Reorganize double underscore tests
* Remove jfreeman from TODO
* Remove unneeded parenthesis
Make Program.getMissingFilePaths required
Assume getMissingFilePaths always returns a defined value
Make getMissingFilePaths internal
Replace nullable-bool with enum
Update type to reflect possibility of undefined
Use deepEqual to simplify tests
Make condition const
Don't bother cleaning up map before freeing it
Switch from foreach to for-of to simplify debugging
Use a Map, rather than a FileMap, to track open FileWatchers
Fix compilation errors
Introduce and consume arrayToSet
Fix lint warnings about misplaced braces
Delete incorrect comment
Delete from map during iteration
Eliminate unnecessary type annotations
1. Expose missing files from the `Program`.
2. In `tsc --watch` and `tsserver`, add file watchers to missing files.
3. When missing files are created, schedule compilation (tsc) or refresh
the containing projects (tsserver).
* importFixes: Support missing "React" at a JSXOpeningElement
* Fix nextLineRule linting
* Rename to resolveJsxNamespaceAtLocation
* Expose getJsxNamespace and resolveNameAtLocation separately
* treat failures to resolve module name as missing packages (#12237)
* added extra check to prevent multiple installation of the same typing, added version field to telemetry event (#12258)
* added extra check to prevent multiple installation of the same typing, added version field to telemetry event
* use ts.version
* switch to execSync to ensure that no install orders are interleaved (#12259)
* Make sure version is public
* Update file with version string for nightly release
* Update LKG
* Update version
* Update LKG
* Skip overloads with too-short function parameters
If the parameter of an overload is a function and the argument is also a
function, skip the overload if the parameter has fewer arguments than
the argument does. That overload cannot possibly apply, and should not
participate in, for example, contextual typing.
Example:
```ts
interface I {
(a: number): void;
(b: string, c): void;
}
declare function f(i: I): void;
f((x, y) => {});
```
This code now skips the first overload instead of considering.
This was a longstanding bug but was only uncovered now that more
functions expressions are context sensitive.
* Test skip overloads w/too-short function params
1. Update changed baseline.
2. Add a new test with baseline.
* Minor style improvements
* Ignore optionality when skipping overloads
* Do not use contextual signatures with too few parameters
* isAritySmaller runs later: getNonGenericSignature
* rewrite void-returning statements in constructors that capture result of super call (#11868)
* rewrite void-returning statements in constructors that capture result of super call
* linter
* Update LKG
* Fix emit inferred type which is a generic type-alias both fully and partially fill type parameters
* Add tests and baselines
* Skip trying to use alias if there is target type
* Update baselines
* Add diagnostics to remind adding tsconfig file for certain external project (#11932)
* Add diagnostics for certain external project
* Show tsconfig suggestion
* fix lint error
* Address pr
* fix comment
* Update error message
* Flag for not overwrite js files by default without generating errors (#11980)
* WIP
* Properly naming things
* refactor
* apply the option to all files and check out options
* Fix typo
* Update LKG
* lockLinter
* use local registry to check if typings package exist (#12014) (#12032)
use local registry to check if typings package exist
* Add test for https://github.com/Microsoft/TypeScript/pull/11980 (#12027)
* add test for the fix for overwrite emitting error
* cr feedback
* enable sending telemetry events to tsserver client (#12034) (#12051)
enable sending telemetry events
* Update LKG
* Reuse subtree transform flags for incrementally parsed nodes (#12088)
* Update LKG
* Update version
* Update LKG
* Do not emit "use strict" when targeting es6 or higher or module kind is es2015 and the file is external module
* Add tests and baselines
* [Release 2.1] fix11754 global augmentation (#12133)
* Exclude global augmentation from module resolution logic
* Address PR: check using string literal instead of NodeFlags.globalAugmentation
* Remove comment