Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isolated declarations #53463

Closed
wants to merge 295 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
295 commits
Select commit Hold shift + click to select a range
0a1f101
Add distinction between keep locals and as const back.
dragomirtitian Aug 16, 2023
15b7e60
Merge pull request #85 from bloomberg/isolated-declarations-slim
dragomirtitian Aug 17, 2023
3a3e7e5
Support default exports
h-joo Aug 17, 2023
220fb0d
[Non-functional] Restructure the fixer
h-joo Aug 18, 2023
6e866ca
Support fixes for mixin heritage clauses
h-joo Aug 18, 2023
8ab3fcb
Support fixes for destructuring patterns
h-joo Aug 18, 2023
7f574a8
Add a test case for Symbol
h-joo Aug 20, 2023
b97e79f
Fix PR Comments
h-joo Aug 22, 2023
c509a6c
Make the fixer replace the classNode instead
h-joo Aug 22, 2023
e4cf7a0
Merge pull request #86 from h-joo/code-mod-fix
dragomirtitian Aug 22, 2023
4a66f33
Restructure to add flexibility to code-mod
h-joo Aug 22, 2023
adb25b1
Port functionality from the language-service
h-joo Aug 22, 2023
a837746
proper handling for destructuring
h-joo Aug 22, 2023
5d88b4e
Properly handle fix for VariableStatments
h-joo Aug 22, 2023
902f5ee
Merge pull request #87 from h-joo/apply-on-code-mod
dragomirtitian Aug 22, 2023
d653203
Fix local inference for default exports and method/constructor signa…
dragomirtitian Aug 17, 2023
cc478de
Added some enum value computation.
dragomirtitian Aug 23, 2023
643d33c
When annotating for function expressions,
h-joo Aug 23, 2023
40f9a58
Merge pull request #89 from h-joo/returnType
dragomirtitian Aug 23, 2023
82dfd3b
Do not print typeof operator for Symbol types
h-joo Aug 23, 2023
49025f5
Merge pull request #90 from h-joo/noTypeof
dragomirtitian Aug 24, 2023
580be4c
Merge pull request #88 from bloomberg/isolated-declarations-enum-impr…
dragomirtitian Aug 24, 2023
cd8feab
Fix various miss-matches between DTE and ts
dragomirtitian Aug 24, 2023
7781968
Fixed rest parameters and removed setting parent node for synthetic t…
dragomirtitian Aug 25, 2023
cb280cc
Added errors for expando function expressions.
dragomirtitian Aug 25, 2023
3d9503d
Add errors in DTE for expando.
dragomirtitian Aug 29, 2023
63c219d
Merge remote-tracking branch 'remotes/origin/main' into isolated-decl…
dragomirtitian Aug 29, 2023
b81cdc0
Merge pull request #91 from bloomberg/isolated-declarations-improvements
dragomirtitian Aug 29, 2023
2af866d
Fix bugs after merge.
dragomirtitian Aug 29, 2023
3ec90b0
Merge pull request #92 from bloomberg/isolated-declarations-improvements
dragomirtitian Aug 29, 2023
7800241
Do not print diagnostics on interface members
h-joo Aug 28, 2023
fe34c87
When reporting IsolatedDeclarations error,
h-joo Aug 30, 2023
9942551
Try not to fail in cases where IsolatedDeclaration
h-joo Aug 30, 2023
2f04c7a
Merge pull request #93 from h-joo/betterDiagnostics
dragomirtitian Aug 30, 2023
0dd34fe
Fix DTE / TS inequivalences
dragomirtitian Aug 30, 2023
1a1d0bd
Fix error caused by trying to emit typeof for inheritance clauses in …
dragomirtitian Aug 30, 2023
7ca6435
Remove tests that now pass from exception list.
dragomirtitian Aug 30, 2023
2d309c6
Fix reference and import diffs.
dragomirtitian Sep 7, 2023
9767aa9
Renamed file from json to jsonc to allow for comments.
dragomirtitian Sep 7, 2023
00d340d
Fix lint error.
dragomirtitian Sep 7, 2023
faa3cf1
Categorized ts that sill have 9007 errors even after having been modi…
dragomirtitian Sep 8, 2023
e772096
Added specific error for expando functions.
dragomirtitian Sep 8, 2023
f1f82f9
Merge pull request #94 from bloomberg/isolated-declarations-improvements
dragomirtitian Sep 11, 2023
dde8cb6
Compute enum values. Forbid inference from parameters with binding pa…
dragomirtitian Sep 13, 2023
aeeb920
Ban reference directives. Some minor fixes.
dragomirtitian Sep 14, 2023
b0d064d
Added sample parallel builder.
dragomirtitian Sep 25, 2023
35d400e
Merge pull request #95 from bloomberg/isolated-declarations-parallel-…
dragomirtitian Sep 25, 2023
aac2f67
Added missing config files.
dragomirtitian Sep 25, 2023
5904193
Merge branch 'isolated-declarations' of https://github.com/bloomberg/…
dragomirtitian Sep 25, 2023
570f403
Preserve formatting in the ID fixer.
dragomirtitian Sep 25, 2023
c6b60fc
Use imports instead of import types.
dragomirtitian Sep 25, 2023
86d5751
Added more descriptive text for fixer messages and enabled fix all.
dragomirtitian Sep 26, 2023
276f9ed
Improve biding handling.
dragomirtitian Sep 26, 2023
9416f38
Ensure nested import types are processed.
dragomirtitian Sep 27, 2023
24a5f53
Added typeof fix for entity names.
dragomirtitian Sep 27, 2023
9c274fd
Added support for relative typing of object literals with spread.
dragomirtitian Sep 27, 2023
60960f8
Fix spread on unique symbols. Add fix for array spread. Write compute…
dragomirtitian Sep 29, 2023
c474481
Added extract to variable refactor.
dragomirtitian Oct 2, 2023
192982e
Remove new lines from code fix description.
dragomirtitian Oct 2, 2023
bee8fa8
Fix crash.
dragomirtitian Oct 2, 2023
c0b63bf
Changed code mod to use language service.
dragomirtitian Oct 4, 2023
62fd7be
Fix code fixer issues for enums and for cases where the target changes.
dragomirtitian Oct 4, 2023
57d243a
Improve inline assertions
dragomirtitian Oct 4, 2023
0dfdee1
Removed fixed tests.
dragomirtitian Oct 5, 2023
9b2fb26
Do not print typeof x for static readonly fields.
dragomirtitian Oct 9, 2023
363e9d1
Fix code review issues.
dragomirtitian Oct 9, 2023
430bedc
Fixed diagnostic message typo.
dragomirtitian Oct 10, 2023
035429c
Merge pull request #96 from bloomberg/isolated-declarations-fixer
dragomirtitian Oct 10, 2023
1f85796
Reintegrate DTE
dragomirtitian Oct 9, 2023
7abf074
Moved transform project api to TS. Improve fixer performance
dragomirtitian Oct 12, 2023
303b991
Merge remote-tracking branch 'remotes/origin/main' into isolated-decl…
dragomirtitian Oct 12, 2023
61b1ea7
Fix tests.
dragomirtitian Oct 12, 2023
3b8e896
Address code review.
dragomirtitian Oct 12, 2023
da9b9c2
Merge pull request #98 from bloomberg/isolated-declarations-integrate…
dragomirtitian Oct 12, 2023
1e14150
Merge branch 'isolated-declarations-integrate-master' into isolated-d…
dragomirtitian Oct 13, 2023
32d02cc
Be explicit of the flag AND operation
h-joo Oct 16, 2023
72451bb
Move ObjectLiteral handling into a function
h-joo Oct 15, 2023
ae1646e
Remove the function mergeFlags
h-joo Oct 16, 2023
b50c877
Do not attempt to generate d.ts files
h-joo Oct 16, 2023
10724ec
Improve type aesthetics
h-joo Oct 16, 2023
98fb92a
Merge single use function into it's caller
h-joo Oct 16, 2023
3077592
Tidy up the public interfaces and accept baseline
h-joo Oct 17, 2023
fb324e5
Fix test cases which were failing due to typos
h-joo Oct 17, 2023
6c2a8d3
Update baselines
h-joo Oct 17, 2023
e9ca3d4
Support class expressions in DTE
h-joo Oct 17, 2023
5c82583
Format files with hereby format
h-joo Oct 17, 2023
a7c15af
Fix PR Comments
h-joo Oct 18, 2023
5e2e6d0
Fix more PR Comments
h-joo Oct 20, 2023
e878ebd
Merge pull request #101 from h-joo/classExpressions
dragomirtitian Oct 20, 2023
981e948
In the declaration emitter, enforce flag for ID
h-joo Oct 19, 2023
ef231d9
Only allow type inference on local members
h-joo Oct 19, 2023
6faac4f
Integrated dte tests into tsc tests.
dragomirtitian Oct 23, 2023
852c2a8
Fixed tests. Added baseline for original isolated declarations tests.
dragomirtitian Oct 23, 2023
2c8eaf5
Improve test performance.
dragomirtitian Oct 24, 2023
24fd810
Added errors in isolated declarations baseline.
dragomirtitian Oct 24, 2023
04cedfe
Added baseline for cases where DTE errors differ from TSC errors for …
dragomirtitian Oct 24, 2023
46e9453
Merge pull request #103 from bloomberg/isolated-declarations-tests
dragomirtitian Nov 6, 2023
a4bec21
Merge pull request #102 from h-joo/enumEval
dragomirtitian Nov 6, 2023
c20406f
Fix typo
h-joo Oct 30, 2023
1c7972f
Generate declaration map
h-joo Oct 24, 2023
87ad092
Append declaration map to dte results in tests
h-joo Oct 24, 2023
d390052
Flip forceDtsEmit to false.
h-joo Oct 29, 2023
83ae26a
Make tests compare emit results
h-joo Oct 30, 2023
011f142
Format files
h-joo Nov 7, 2023
883cc69
Merge pull request #104 from h-joo/declarationMap
dragomirtitian Nov 11, 2023
ae61dd6
Integrated fixed tests.
dragomirtitian Nov 11, 2023
d6f9d2d
Added test baseline
dragomirtitian Nov 11, 2023
9c80f76
Fixed most tests after merging features.
dragomirtitian Nov 12, 2023
ea7b82a
Remove path from test.
dragomirtitian Nov 13, 2023
36e5505
Added new line before errors.
dragomirtitian Nov 13, 2023
4a4312f
Disable forceDtsEmit for fixed tests.
dragomirtitian Nov 13, 2023
5a7784c
Fixed source maps differences.
dragomirtitian Nov 13, 2023
9856f97
Removed comment
dragomirtitian Nov 13, 2023
e1a2304
Removed parallel-build and external-declarations folders.
dragomirtitian Nov 13, 2023
3936d4a
Added missing baseline.
dragomirtitian Nov 13, 2023
a406046
Merge pull request #107 from bloomberg/isolated-declarations-cleanup
dragomirtitian Nov 13, 2023
ffe4b1c
Removed unfixed tests.
dragomirtitian Nov 14, 2023
3023b9f
Merge pull request #106 from bloomberg/isolated-declarations-tests
dragomirtitian Nov 14, 2023
9a3db9c
Updated fixer compiler settings.
dragomirtitian Nov 14, 2023
9dc09ca
Merge remote-tracking branch 'remotes/origin/main' into isolated-decl…
dragomirtitian Nov 14, 2023
fca6fb1
Refactor evaluator to be outside the checker.
dragomirtitian Nov 14, 2023
35ccc67
Merge pull request #108 from bloomberg/isolated-declarations-evaluator
dragomirtitian Nov 14, 2023
767f0fe
Do not report and bail if node has a parse error.
dragomirtitian Nov 15, 2023
57f21b1
Merge pull request #109 from bloomberg/isolated-declarations-skip-par…
dragomirtitian Nov 17, 2023
91c8b76
Minor Fixes. Added reasons for current diffs
dragomirtitian Nov 17, 2023
e45e9b8
Ensure we mark tests that have reference declaration errors.
dragomirtitian Nov 20, 2023
c236425
Fixed some code review suggestions.
dragomirtitian Nov 20, 2023
2862991
Merge pull request #111 from bloomberg/isolated-declarations-categori…
dragomirtitian Nov 21, 2023
93912bb
Minimize API surface.
dragomirtitian Nov 21, 2023
f086f35
Do not support class expressions in IsolatedDeclarations.
h-joo Nov 22, 2023
672a57a
Merge pull request #113 from h-joo/errorOnClassExpressions
dragomirtitian Nov 23, 2023
1074f9a
Merge pull request #112 from bloomberg/isolated-declarations-api
dragomirtitian Nov 23, 2023
eeb8a9f
Added missing test reasons and baselines
dragomirtitian Nov 23, 2023
b7d062a
Reviewed miss matched maps.
dragomirtitian Nov 23, 2023
6f3a0ec
Improved type safety in declarations
dragomirtitian Nov 23, 2023
23840f4
Renamed files.
dragomirtitian Nov 23, 2023
96c9c15
Hide symbol tracker if in isolated declarations mode.
dragomirtitian Nov 24, 2023
2dfc9d1
Merge pull request #115 from bloomberg/isolated-declarations-refactor
dragomirtitian Nov 25, 2023
867e100
Merge pull request #114 from bloomberg/isolated-declarations-missing-…
dragomirtitian Nov 27, 2023
3199057
Fixed optional constructor properties.
dragomirtitian Nov 24, 2023
9ca6342
Removed unused baseline files.
dragomirtitian Nov 25, 2023
d4e8654
Merge pull request #116 from bloomberg/isolated-declarations-ctor-props
dragomirtitian Nov 27, 2023
1d882e1
Fix new methods in types. Minor refactoring.
dragomirtitian Nov 24, 2023
cf214ae
Merge pull request #117 from bloomberg/isolated-declarations-new
dragomirtitian Nov 27, 2023
9c19913
Merge pull request #119 from bloomberg/isolated-declarations-baseline…
dragomirtitian Nov 27, 2023
da557b0
Fixed errors in DTE when enums are accessed through a dotted identifier.
dragomirtitian Nov 25, 2023
24d8a3c
Merge pull request #118 from bloomberg/isolated-declarations-enums
dragomirtitian Nov 27, 2023
a8c29dc
Moved expando function member detection to binder.
dragomirtitian Nov 27, 2023
c0d6726
Updated baseline. And added more tests.
dragomirtitian Nov 27, 2023
6ca0b26
Merge remote-tracking branch 'remotes/origin/main' into isolated-decl…
dragomirtitian Nov 28, 2023
0f12363
Fix test failures after master merge.
dragomirtitian Nov 28, 2023
cf1ca98
Revert change in checker that prevented TS from removing symbols impo…
dragomirtitian Nov 28, 2023
92b3dcb
Update the reason for not fixing types
h-joo Nov 28, 2023
26e9574
Changed condition.
dragomirtitian Nov 29, 2023
7ab0f0d
Merge pull request #120 from bloomberg/isolated-declarations-expando-…
dragomirtitian Nov 29, 2023
7067307
Fixed imports to use namespace imports. Other minor fixes
dragomirtitian Nov 28, 2023
4e01096
Merge pull request #122 from h-joo/fixerIssues
dragomirtitian Nov 29, 2023
c0831c2
Merge pull request #121 from bloomberg/isolated-declarations-unused-i…
dragomirtitian Nov 29, 2023
d9328ea
Merge pull request #123 from bloomberg/isolated-declarations-pr-review
dragomirtitian Nov 29, 2023
d89c2ae
Cleanup baseline.
dragomirtitian Nov 30, 2023
500d2a3
Document reasons for fixer not generating fixes.
h-joo Nov 29, 2023
af1e6fa
Merge pull request #126 from h-joo/unfixed
dragomirtitian Nov 30, 2023
8dcb272
Fixed new lines.
dragomirtitian Nov 30, 2023
7bffe7e
Suppress tests that fail due to TS bug
dragomirtitian Nov 30, 2023
31370b0
Merge remote-tracking branch 'remotes/origin/main' into isolated-decl…
dragomirtitian Nov 30, 2023
f7a65aa
Added baseline for new tests after merge.
dragomirtitian Nov 30, 2023
142ff2b
Forbid the flag of --out, --outFile with the use of --isolatedDeclara…
h-joo Dec 1, 2023
62318bf
Merge pull request #128 from h-joo/forBidFlags
dragomirtitian Dec 1, 2023
69d991a
Deduplicated code for symbol visibility checks.
dragomirtitian Nov 30, 2023
4554796
Merge pull request #127 from bloomberg/isolated-declarations-visibili…
dragomirtitian Dec 4, 2023
1b4c121
Use TSC resolver for isolated declaration emit in TSC
dragomirtitian Dec 2, 2023
898eb0f
Remove unused baseline
dragomirtitian Dec 2, 2023
fb08ff8
Refactor binder to use switch statements and functions.
dragomirtitian Dec 2, 2023
261eba5
Updated baseline
dragomirtitian Dec 4, 2023
2c0bf81
Fixed some typos in test cases.
dragomirtitian Dec 5, 2023
d91c282
Merge pull request #129 from bloomberg/isolated-declarations-use-tsc-…
dragomirtitian Dec 5, 2023
f1cfac4
Update reasons for individual tests
h-joo Dec 8, 2023
a0f31ee
Unmark a test from TODO of which
h-joo Dec 11, 2023
901c7e3
Remove TODO which were already fixed
h-joo Dec 11, 2023
e18d2e8
Merge pull request #130 from h-joo/updateReasons
dragomirtitian Dec 11, 2023
c5ddc9b
Remove isolatedDeclarationDiffReason
h-joo Dec 11, 2023
afaec96
Merge remote-tracking branch 'remotes/origin/main' into isolated-decl…
dragomirtitian Dec 11, 2023
211b056
Improve declaration emit type safety.
dragomirtitian Nov 29, 2023
97161e0
Added kind to transformation context.
dragomirtitian Dec 13, 2023
a6fe9fc
Removed traceResolution: true
dragomirtitian Dec 13, 2023
f49ebd9
Removed duplicate usage of node in fix.
dragomirtitian Dec 14, 2023
5531cef
Support lookup for namespace when binding expando functions
h-joo Dec 13, 2023
970c397
"Update tests and remove TODOs
h-joo Dec 15, 2023
c45ffaf
Addressed code review.
dragomirtitian Jan 2, 2024
fcfb698
Improve expando function errors.
dragomirtitian Dec 7, 2023
66b6ac1
Improved return type errors.
dragomirtitian Dec 8, 2023
03135a7
Improved errors
dragomirtitian Dec 11, 2023
7133c47
Updated baseline
dragomirtitian Dec 11, 2023
d1f598a
Fix bug in code fix for shorthand assignment.
dragomirtitian Dec 11, 2023
20c5351
Remove extra errors when a computed property already isn't valid.
dragomirtitian Dec 11, 2023
9ecd15f
Added specific error for default exports.
dragomirtitian Dec 11, 2023
3f0ca54
Updated baseline.
dragomirtitian Dec 11, 2023
4164b9b
Updated baseline. Removed unused reasons.
dragomirtitian Dec 12, 2023
d99cdf5
Minor fixes to code.
dragomirtitian Dec 12, 2023
857f90b
Updated error messages.
dragomirtitian Dec 12, 2023
a3a5049
Added back runtime members to nullTransformationContext
dragomirtitian Jan 3, 2024
202d522
Changed null context to have all methods from the regular transformat…
dragomirtitian Jan 4, 2024
be73e33
Merge pull request #124 from bloomberg/isolated-declarations-safety-i…
dragomirtitian Jan 8, 2024
c223e05
Merge pull request #131 from bloomberg/isolated-declarations-error-me…
dragomirtitian Jan 8, 2024
b7d936c
Merge pull request #132 from h-joo/fixTests
dragomirtitian Jan 8, 2024
7776b34
Merge remote-tracking branch 'remotes/origin/main' into isolated-decl…
dragomirtitian Jan 8, 2024
c3c863d
Factor out repeated code and call one from another,
h-joo Nov 29, 2023
a97dfbc
Update baselines
h-joo Dec 6, 2023
04097f6
Merge pull request #125 from h-joo/refactorSourceMaps
dragomirtitian Jan 8, 2024
71131db
Merge branch 'isolated-declarations' of https://github.com/bloomberg/…
dragomirtitian Jan 8, 2024
8e9f0f5
Merge remote-tracking branch 'remotes/bloomberg/isolated-declarations…
dragomirtitian Jan 8, 2024
52158b5
skipErrorComparison for isolated declaration tests.
dragomirtitian Jan 3, 2024
999d03e
Skip tests with syntactic errors.
dragomirtitian Jan 3, 2024
5a1db4f
Only run declaration tests.
dragomirtitian Jan 3, 2024
d097266
Removed unused baseline.
dragomirtitian Jan 3, 2024
8b4221e
Use combined code fix
dragomirtitian Jan 4, 2024
868f250
Add back fixing diagnostic by diagnostic after fix all.
dragomirtitian Jan 4, 2024
4097ae1
Updated baseline
dragomirtitian Jan 8, 2024
c0b4867
Addressed code review.
dragomirtitian Jan 8, 2024
f0fad1b
Merge pull request #133 from bloomberg/isolated-declarations-perf-2
dragomirtitian Jan 8, 2024
7cf4447
Update binding element differences.
dragomirtitian Jan 9, 2024
ef6a868
Merge branch 'isolated-declarations' of https://github.com/bloomberg/…
dragomirtitian Jan 9, 2024
0ad2847
Updated baseline.
dragomirtitian Jan 9, 2024
3b6033b
Merge remote-tracking branch 'remotes/origin/main' into isolated-decl…
dragomirtitian Jan 12, 2024
d27c784
Added sources to baseline to show auto-fixed code.
dragomirtitian Jan 12, 2024
7c4dbed
Removed fix for alias parameter removal (not needed anymore)
dragomirtitian Jan 12, 2024
c3245bb
Fixed formatting.
dragomirtitian Jan 12, 2024
b2706e0
Fixed minor code review issues.
dragomirtitian Jan 12, 2024
27ff8b2
Merge remote-tracking branch 'remotes/origin/main' into isolated-decl…
dragomirtitian Jan 13, 2024
2164696
Updated baseline.
dragomirtitian Jan 13, 2024
e2e6adc
Convert while into a for loop, and remove comment where it's not needed
h-joo Jan 14, 2024
6987970
Merge pull request #134 from h-joo/reviewComments
dragomirtitian Jan 15, 2024
b2b946c
Changed bind to arrow function.
dragomirtitian Jan 15, 2024
2b27f43
Merge branch 'isolated-declarations' of https://github.com/bloomberg/…
dragomirtitian Jan 15, 2024
47374f3
Removed namespaces for fixer.
dragomirtitian Jan 15, 2024
6803a00
Fix bugs from testing in real project.
dragomirtitian Jan 16, 2024
edc4d32
Addressed code review comments.
dragomirtitian Jan 16, 2024
f65c3b6
Addressed feedback
dragomirtitian Jan 16, 2024
5ff13fb
Merge pull request #135 from bloomberg/isolated-declarations-real-fixes
dragomirtitian Jan 16, 2024
8347b23
Remove stale diff reasons.
dragomirtitian Jan 16, 2024
373aaf4
Made test names more consistent.
dragomirtitian Jan 17, 2024
163e4ba
Changed command line option flags for isolated declarations.
dragomirtitian Jan 17, 2024
571e43f
Merge branch 'isolated-declarations' of https://github.com/bloomberg/…
dragomirtitian Jan 17, 2024
e7ad116
Fixed formatting.
dragomirtitian Jan 17, 2024
a81b583
Merge pull request #136 from bloomberg/isolated-declarations-remove-s…
dragomirtitian Jan 17, 2024
418f975
Addressed small review issues.
dragomirtitian Jan 17, 2024
3188a82
Remove binder from transpileDeclaration implementation.
dragomirtitian Jan 18, 2024
e1bb300
Fix emit resolver to use same name resolver as the checker.
dragomirtitian Jan 19, 2024
dc1ffe9
Switched over to `entityNameToString`
dragomirtitian Jan 21, 2024
a9d06d7
Merge pull request #138 from bloomberg/isolated-declaration-reuse-binder
dragomirtitian Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions src/compiler/_namespaces/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export * from "../transformers/module/system";
export * from "../transformers/module/esnextAnd2015";
export * from "../transformers/module/node";
export * from "../transformers/declarations/diagnostics";
export * from "../transformers/declarations/emitResolver";
export * from "../transformers/declarations/transpileDeclaration";
export * from "../transformers/declarations/localInferenceResolver";
export * from "../transformers/declarations";
export * from "../transformer";
export * from "../emitter";
Expand Down
1,228 changes: 234 additions & 994 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,15 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
description: Diagnostics.Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting,
defaultValueDescription: false,
},
{
name: "isolatedDeclarations",
type: "boolean",
category: Diagnostics.Interop_Constraints,
description: Diagnostics.Ensure_that_each_file_can_have_declaration_emit_generated_without_type_information,
defaultValueDescription: false,
dragomirtitian marked this conversation as resolved.
Show resolved Hide resolved
affectsBuildInfo: true,
affectsEmit: true,
},

// Strict Type Checks
{
Expand Down
14 changes: 9 additions & 5 deletions src/compiler/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
AssertionLevel,
BigIntLiteralType,
CheckMode,
Comparer,
compareValues,
EmitFlags,
every,
Expand Down Expand Up @@ -386,18 +387,18 @@ export namespace Debug {
* Formats an enum value as a string for debugging and debug assertions.
*/
export function formatEnum(value = 0, enumObject: any, isFlags?: boolean) {
const members = getEnumMembers(enumObject);
const members = getEnumMembers(enumObject, isFlags);
if (value === 0) {
return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
}
if (isFlags) {
const result: string[] = [];
let remainingFlags = value;
for (const [enumValue, enumName] of members) {
if (enumValue > value) {
if (enumValue > remainingFlags) {
break;
}
if (enumValue !== 0 && enumValue & value) {
if (enumValue !== 0 && enumValue & remainingFlags) {
result.push(enumName);
remainingFlags &= ~enumValue;
}
Expand All @@ -418,7 +419,7 @@ export namespace Debug {

const enumMemberCache = new Map<any, SortedReadonlyArray<[number, string]>>();

function getEnumMembers(enumObject: any) {
function getEnumMembers(enumObject: any, isFlags?: boolean) {
// Assuming enum objects do not change at runtime, we can cache the enum members list
// to reuse later. This saves us from reconstructing this each and every time we call
// a formatting function (which can be expensive for large enums like SyntaxKind).
Expand All @@ -435,7 +436,10 @@ export namespace Debug {
}
}

const sorted = stableSort<[number, string]>(result, (x, y) => compareValues(x[0], y[0]));
const comparer: Comparer<[number, string]> = isFlags ?
(x, y) => compareValues(x[0] >>> 0, y[0] >>> 0) :
(x, y) => compareValues(x[0], y[0]);
const sorted = stableSort(result, comparer);
enumMemberCache.set(enumObject, sorted);
return sorted;
}
Expand Down
165 changes: 165 additions & 0 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6227,6 +6227,11 @@
"category": "Message",
"code": 6718
},
"Ensure that each file can have declaration emit generated without type information": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Ensure that each file can have declaration emit generated without type information": {
"Ensure that each file can have declaration emit generated without reading other files": {

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these are true. it does allow one file at a time declaration emit, but it also ensures that not types need to be created by the type checker. I feel the latter constraint is the stricter one since it forbids most inference even if the information is available in the file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what’s going on in localInferenceResolver.ts is “type information,” but I take your point that needing to annotate function return types is probably more visible to users than the lack of cross-file information.

"category": "Message",
"code": 6719
},

"Default catch clause variables as 'unknown' instead of 'any'.": {
"category": "Message",
"code": 6803
Expand Down Expand Up @@ -6741,6 +6746,130 @@
"category": "Error",
"code": 9006
},
"Function must have an explicit return type annotation with --isolatedDeclarations.": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
"Function must have an explicit return type annotation with --isolatedDeclarations.": {
"Function must have an explicit return type annotation with '--isolatedDeclarations'.": {

is the typical style. My ear also slightly prefers in '--isolatedDeclarations' over with, while the wordier when '--isolatedDeclarations' is enabled is more established... I don’t have a very strong opinion here.

"category": "Error",
"code": 9007
},
"Method must have an explicit return type annotation with --isolatedDeclarations.": {
"category": "Error",
"code": 9008
},
"At least one accessor must have an explicit return type annotation with --isolatedDeclarations.": {
"category": "Error",
"code": 9009
},
"Variable must have an explicit type annotation with --isolatedDeclarations.": {
"category": "Error",
"code": 9010
},
"Parameter must have an explicit type annotation with --isolatedDeclarations.": {
"category": "Error",
"code": 9011
},
"Property must have an explicit type annotation with --isolatedDeclarations.": {
"category": "Error",
"code": 9012
},
"Expression type can't be inferred with --isolatedDeclarations.": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: “cannot” is typical

"category": "Error",
"code": 9013
},
"Computed properties must be number or string literals, variables or dotted expressions with --isolatedDeclarations.": {
"category": "Error",
"code": 9014
},
"Objects that contain spread assignments can't be inferred with --isolatedDeclarations.": {
"category": "Error",
"code": 9015
},
"Objects that contain shorthand properties can't be inferred with --isolatedDeclarations.": {
"category": "Error",
"code": 9016
},
"Only const arrays can be inferred with --isolatedDeclarations.": {
"category": "Error",
"code": 9017
},
"Arrays with spread elements can't inferred with --isolatedDeclarations.": {
"category": "Error",
"code": 9018
},
"Binding elements can't be exported directly with --isolatedDeclarations.": {
"category": "Error",
"code": 9019
},
"Enum member initializers must be computable without references to external symbols with --isolatedDeclarations.": {
"category": "Error",
"code": 9020
},
"Extends clause can't contain an expression with --isolatedDeclarations.": {
"category": "Error",
"code": 9021
},
"Inference from class expressions is not supported with --isolatedDeclarations.": {
"category": "Error",
"code": 9022
},
"Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function.": {
"category": "Error",
"code": 9023
},
"Declaration emit for this file requires adding a type reference directive which are not supported with --isolatedDeclarations": {
"category": "Error",
"code": 9024
},
"Reference directives are not supported with --isolatedDeclarations.": {
"category": "Error",
"code": 9025
},
"Declaration emit for this file requires preserving this import for augmentations. This is not supported with --isolatedDeclarations.": {
"category": "Error",
"code": 9026
},
"Add a type annotation to the variable {0}.": {
"category": "Error",
"code": 9027
},
"Add a type annotation to the parameter {0}.": {
"category": "Error",
"code": 9028
},
"Add a type annotation to the property {0}.": {
"category": "Error",
"code": 9029
},
"Add a return type to the function expression.": {
"category": "Error",
"code": 9030
},
"Add a return type to the function declaration.": {
"category": "Error",
"code": 9031
},
"Add a return type to the get accessor declaration.": {
"category": "Error",
"code": 9032
},
"Add a type to parameter of the set accessor declaration.": {
"category": "Error",
"code": 9033
},
"Add a return type to the method": {
"category": "Error",
"code": 9034
},
"Add a type assertion to this expression to make type type explicit.": {
"category": "Error",
"code": 9035
},
"Move the expression in default export to a variable and add a type annotation to it.": {
"category": "Error",
"code": 9036
},
"Default exports can't be inferred with --isolatedDeclarations.": {
"category": "Error",
"code": 9037
},
"JSX attributes must only be assigned a non-empty 'expression'.": {
"category": "Error",
"code": 17000
Expand Down Expand Up @@ -7055,6 +7184,42 @@
"category": "Message",
"code": 90060
},
"Add annotation of type '{0}'": {
"category": "Message",
"code": 90061
},
"Add return type '{0}'": {
"category": "Message",
"code": 90062
},
"Extract base class to variable": {
"category": "Message",
"code": 90064
},
"Extract default export to variable": {
"category": "Message",
"code": 90065
},
"Extract binding expressions to variable": {
"category": "Message",
"code": 90066
},
"Add all missing type annotations": {
"category": "Message",
"code": 90067
},
"Add inline type assertion to '{0}'": {
"category": "Message",
"code": 90068
},
"Extract to variable and replace with '{0} typeof {0}'": {
"category": "Message",
"code": 90069
},
"Mark array literal as const": {
"category": "Message",
"code": 90070
},

"Convert function to an ES2015 class": {
"category": "Message",
Expand Down
Loading
Loading