33981 Commits

Author SHA1 Message Date
Jake Bailey
c65142244c Add dts bundling
This adds a "small" d.ts bundler script. This script is very basic,
using Node printing to produce its output. Generally speaking, this is
inadvisable as it completely disregards name shadowing, globals, etc.
However, in our case, we don't care about the globals, and we can opt to
restructure our codebase in order to avoid conflict, which we largely
had to do anyway when we were namespaces and everything was in scope.
2022-11-07 13:35:48 -08:00
Jake Bailey
4139807e75 Add build via esbuild
This configures the existing build tasks to use esbuild by default. If
using the plain files is desired, passing `--bundle=false` will build
using plain files and still produce a runnable system.

This is only a basic build; a more efficient build is provided later
when gulp is replaced by hereby.
2022-11-07 13:34:44 -08:00
Jake Bailey
36e29448e9 Get codebase building pre bundling
This isn't totally complete, but enough to get everything building and
tests running manually. The next commit will make the build work fully.
2022-11-07 13:34:44 -08:00
Jake Bailey
6dfa4299d7 Remove typescriptServices, protocol.d.ts, typescript_standalone.d.ts
This is the same as TypeScript PR 51026.
2022-11-07 13:34:44 -08:00
Jake Bailey
01e5200096 Convert require calls to imports
Although the existing require calls would work fine, it's more
consistent to make them actual imports and let them be converted at
compile/bundle time. It also lets us emit ESM if needed.

There are still conditional requires present for things like the node
System, but that's a more difficult problem to solve.
2022-11-07 13:34:44 -08:00
Jake Bailey
d12116d8da Fix all internal JSDoc comments
If these are regular comments, then they won't appear in our d.ts files.
But, now we are relying on an external d.ts bundler to produce our final
merged, so they need to be present in the "input" d.ts files, meaning
they have to be JSDoc comments.

These comments only work today because all of our builds load their TS
files from scratch, so they see the actual source files and their
non-JSDoc comments.

The comments also need to be attached to a declaration, not floating,
otherwise they won't be used by api-extractor, so move them if needed.
2022-11-07 13:34:44 -08:00
Jake Bailey
231fa27f89 Add JSDoc eslint rule
See the next commit for a more fleshed-out description.
2022-11-07 13:33:08 -08:00
Jake Bailey
8bd5e54af3 Undo changes needed to load codebase into ts-morph 2022-11-07 13:33:08 -08:00
Jake Bailey
39e27fbb6b Fix up linting, make lint clean
Now that we are modules, there's no reason to ban multiple namespaces
per file; each file is its own scope and declaring a namespace won't
merge it into any other files.
2022-11-07 13:33:07 -08:00
Jake Bailey
180554c99e Make processDiagnosticMessages generate a module 2022-11-07 13:33:07 -08:00
Jake Bailey
d5274a9f4a Add gitlens settings suggestion
While GitHub automatically uses this file if present, GitLens in VS Code
does not. Add the right option to our example settings.json for those
who use the extension.

Unfortunately, you can't leave this enabled if you want to look at the
repo _without_ the file; git blame just crashes when the file isn't
present. I'm not sure that there's a workaround for that.
2022-11-07 13:33:07 -08:00
Jake Bailey
5f5ccc9df3 Generated module conversion step - .git-ignore-blame-revs 2022-11-07 13:33:07 -08:00
Jake Bailey
07758c08ab Generated module conversion step - inlineImports
This step converts as many explicit accesses as possible in favor of direct imports from the modules in which things were declared. This restores the code (as much as possible) back to how it looked originally before the explicitify step, e.g. instead of "ts.Node" and "ts.Symbol", we have just "Node" and "Symbol".
2022-11-07 13:33:07 -08:00
Jake Bailey
b6c0538826 Generated module conversion step - stripNamespaces
This step converts each file into an exported module by hoisting the namespace bodies into the global scope and transferring internal markers down onto declarations as needed.

The namespaces are reconstructed as "barrel"-style modules, which are identical to the old namespace objects in structure. These reconstructed namespaces are then imported in the newly module-ified files, making existing expressions like "ts." valid.
2022-11-07 13:32:03 -08:00
Jake Bailey
9a0b85ce2a Generated module conversion step - explicitify
This step makes all implicit namespace accesses explicit, e.g. "Node" turns into "ts.Node".
2022-11-07 13:29:05 -08:00
Jake Bailey
94724a8c2e Generated module conversion step - unindent
This step makes further commits look clearer by unindenting all of the top level namespaces preemptively.
2022-11-07 13:28:13 -08:00
Jake Bailey
7698653c64 Explicitly reference ts namespace in tsserverlibrary 2022-11-07 13:27:19 -08:00
Jake Bailey
df89c7457d Make a few changes to allow all code to be loaded as one project 2022-11-07 13:27:19 -08:00
Wesley Wigham
d83a5e1281
Fix nightly post-#50528 merge (#51432) 2022-11-07 13:15:51 -08:00
Mateusz Burzyński
a329210166
Fixed a regression with discriminating unions based on a union property against undefined with strictNullChecks: false (#49648)
* Fixed a regression with discriminating unions based on a union property against `undefined` with `strictNullChecks: false`

* Add additional test case from the issue comment
2022-11-07 12:17:59 -08:00
Sheetal Nandi
7b0df1ff99
Pass in information for the module name resolution when resolutions from file are partially used (#49738)
* Test showing wrong resolution is returned because of incorrect mode calculation
Test for #48229

* Pass in information for the module name resolution when resolutions from file are partially used
Fixes #48229

* Make the resolution info complete
2022-11-07 11:51:04 -08:00
Oleksandr T
fa4b49d541
fix(51374): ts(80004): Quick fix... > Annotate with type from JSDoc :: object types (#51378)
* fix(51374): transform JSDocTypeLiteral

* add additional tests

* add additional tests
2022-11-07 11:35:08 -08:00
Sheetal Nandi
eac566b8c3
Enables passing --declaration, --emitDeclarationOnly, --declarationMap, --soureMap and --inlineSourceMap to tsc --build (#51241)
* Add different tests for baselining before behavior

* Fix assert for first project output

* Add ability to pass declaration, declarationMap, emitDeclarationOnly, sourceMap and inlineSourceMap on commandline of --build

* Store these options in --out scenario

* Store buildInfo program for --out even if not composite

* Changes to make these commanline options work

* Do not include sourceMapUrl text in the sourceFile version

* Emit complete program in --out scenario as well since we need to determine uptodate ness

* Copy js or dts bundle from old build if emitting only js or dts files

* Dont emit dts if we want to emit only js files even though options suggest emitting d.ts files as well

* Adding comments and refactoring some of the code
2022-11-07 10:53:22 -08:00
TypeScript Bot
896b922871 Update package-lock.json 2022-11-07 06:07:32 +00:00
TypeScript Bot
9371edcb59 Update package-lock.json 2022-11-06 06:06:54 +00:00
Sheetal Nandi
354891cf43
Avoid unnecessary buildInfo read if host supports caching it (avoids in --build scenario) and some reporting cleanup (#51403)
* Emit diagnostics when just manipuating bundle at that time itself
[4:04:42 PM] Updating output of project '/TypeScript/src/tsserver/tsconfig.json'...

Memory used:        581215K
transformTime time:   0.01s
Source Map time:      0.35s
commentTime time:     0.00s
printTime time:       0.58s
Emit time:            0.90s
I/O Write time:       0.01s
Total time:           0.90s

* Pull out getSourceFile and writeFile in a function

* Fix incorrect solutionPerformance reporting in watch mode

* Remove unnecessary build info read when host can give cached buildInfo

* Simplify overloads

* Accept API change
2022-11-04 19:19:57 -07:00
Anders Hejlsberg
f0216e3421
Improve reduction of similar intersections in type inference (#51405)
* Change criteria for reducing intersections in type inference

* Add regression test
2022-11-04 17:04:05 -07:00
Andrew Casey
f1d62f4dc4
Change watchdog tagged users (#51411) 2022-11-04 15:23:08 -07:00
Sheetal Nandi
5e3fa9b87b
There is no use of creating reference map with --out since its not used anyways (#51379)
* Convert some of the tests to baselines

* There is no use of creating reference map with --out since its not used anyways.
The changes to affectedFileList returned should be intended since --out needs saving just one file for correct output and not both
2022-11-03 15:30:32 -07:00
Anders Hejlsberg
7cf842b42b
Enum unification and improvements (#50528)
* Fix enum classification and evaluation

* References in literal enums must be to other enum members

* Accept new baselines

* Unify enum types + template literal constant expressions

* Accept new baselines

* Fix fourslash tests

* Fix new compiler errors

* Fix lint error

* Accept new API baselines

* Fix test

* Better error message + consistently check enum initializers

* Accept new baselines
2022-11-03 11:05:42 -07:00
TypeScript Bot
5a40875fc4 Update package-lock.json 2022-11-03 06:07:44 +00:00
Sheetal Nandi
610ae68ecf
Serialize and use files that can be emitted as affectedFilesPendingEmit (#51364) 2022-11-02 14:55:37 -07:00
Sheetal Nandi
8ed84e1c85
Write original fileInfo when its not just string = version = signature in readable baseline (#51391) 2022-11-02 13:55:20 -07:00
Gabriela Araujo Britto
3568eba026 fix test baseline 2022-11-02 13:46:32 -07:00
Zzzen
6017625ad5
do not report use-before-declaration error in async IIFE initializer (#50199) 2022-11-02 11:41:04 -07:00
Mateusz Burzyński
46b015f2bf
Fixed the issue with some longer variadic tuples with any rest being incorrectly assignable to shorter variadic tuples (#50218) 2022-11-02 11:35:17 -07:00
Gabriela Araujo Britto
fdcb2ffd1b
Fix services' type's isLiteral implementation (#50929)
* fix services' type's isLiteral

* update literal completions tests

* remove booleans from literals
2022-11-02 11:28:10 -07:00
TypeScript Bot
c1e9afd542 Update package-lock.json 2022-11-02 06:10:57 +00:00
TypeScript Bot
8efa88f180 Update package-lock.json 2022-11-01 06:12:36 +00:00
Wesley Wigham
4d15bb16e1
Fix #50869, only cache calculated type for non-context sensitive parameters (#50976)
* Fix #50869, only cache calculated type for non-context sensitive parameters

* Simplify check, update comment
2022-10-31 17:24:51 -07:00
Daniel Rosenwasser
c49c733c1f
Bump version to 5.0. 2022-10-31 13:42:28 -07:00
Sheetal Nandi
7c580111df
Set impliedNodeFormat on sourceFile we get from host to ensure the field is set correctly (#50977)
* Add test that fails

* Handle impliedNodeFormat when handling sourceFileCache
Fixes #50872

* Revert the fix

* Make sure impliedNodeFormat is set for the sourceFile

* Revert "Make sure impliedNodeFormat is set for the sourceFile"

This reverts commit 651a47fdd6ea200e59fdf150dfa913230a86653a.

* Revert "Revert the fix"

This reverts commit 5c98b9cfc1f275877d8d57a60f8f28a5c8d08157.

* Swap the keys for map
2022-10-31 11:26:36 -07:00
Sheetal Nandi
cfa55f1c2d
Fixes the tests that got disabled when generating config set es2016 expecting to find libFile and remove incorrect affects flag from listFilesOnly (#51243)
* Fix the existing test

* Remove affectsEmit from listFilesOnly
2022-10-31 10:15:19 -07:00
Sheetal Nandi
18f559faf9
Store array only if dtsOnly emit is pending to compress buildinfo (#51246) 2022-10-31 10:14:22 -07:00
TypeScript Bot
e50bb07bc1 Update package-lock.json 2022-10-31 06:07:50 +00:00
TypeScript Bot
e5cd686def Update package-lock.json 2022-10-30 06:07:26 +00:00
TypeScript Bot
8d40dc15d1 Update package-lock.json 2022-10-29 06:07:05 +00:00
Ron Buckton
5cfb3a2fe3
Only call return() for an abrupt completion in user code (#51297) 2022-10-28 18:36:40 -04:00
Ron Buckton
a7a9d158e8
Fix for broken baseline in yieldInForInInDownlevelGenerator (#51345) 2022-10-28 16:56:53 -04:00
Ron Buckton
7f8426f4df
fix for-in enumeration containing yield in generator (#51295) 2022-10-28 15:09:10 -04:00