Skip to content

Commit e2e7d44

Browse files
deps(deps): bump microsoft/typescript-go from 4916e22 to f60eb37 (#4)
* deps(deps): bump microsoft/typescript-go from `4916e22` to `f60eb37` Bumps [microsoft/typescript-go](https://github.com/microsoft/typescript-go) from `4916e22` to `f60eb37`. - [Commits](microsoft/typescript-go@4916e22...f60eb37) --- updated-dependencies: - dependency-name: microsoft/typescript-go dependency-version: f60eb374240d9ecdd29cbe2186a3b77e3ccf6a7e dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * chore(sync): mirror internal packages into pkg/ (auto) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 21b5616 commit e2e7d44

File tree

10 files changed

+134
-30
lines changed

10 files changed

+134
-30
lines changed

pkg/checker/checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13987,7 +13987,7 @@ func (c *Checker) checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(nod
1398713987
// TODO: how to get name for export *?
1398813988
name := "*"
1398913989
if !ast.IsExportDeclaration(typeOnlyDeclaration) {
13990-
name = getNameFromImportDeclaration(typeOnlyDeclaration).Text()
13990+
name = typeOnlyDeclaration.Name().Text()
1399113991
}
1399213992
c.error(decl.ModuleReference, message).AddRelatedInfo(createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name))
1399313993
}

pkg/checker/utilities.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -189,20 +189,6 @@ func IsInTypeQuery(node *ast.Node) bool {
189189
}) != nil
190190
}
191191

192-
func getNameFromImportDeclaration(node *ast.Node) *ast.Node {
193-
switch node.Kind {
194-
case ast.KindImportSpecifier:
195-
return node.AsImportSpecifier().Name()
196-
case ast.KindNamespaceImport:
197-
return node.AsNamespaceImport().Name()
198-
case ast.KindImportClause:
199-
return node.AsImportClause().Name()
200-
case ast.KindImportEqualsDeclaration:
201-
return node.AsImportEqualsDeclaration().Name()
202-
}
203-
return nil
204-
}
205-
206192
func nodeCanBeDecorated(useLegacyDecorators bool, node *ast.Node, parent *ast.Node, grandparent *ast.Node) bool {
207193
// private names cannot be used with decorators yet
208194
if useLegacyDecorators && node.Name() != nil && ast.IsPrivateIdentifier(node.Name()) {

pkg/execute/tsc.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,14 @@ func tscCompilation(sys tsc.System, commandLine *tsoptions.ParsedCommandLine, te
193193
return tsc.CommandLineResult{Status: tsc.ExitStatusSuccess}
194194
}
195195
if configForCompilation.CompilerOptions().Watch.IsTrue() {
196-
watcher := createWatcher(sys, configForCompilation, reportDiagnostic, reportErrorSummary, testing)
196+
watcher := createWatcher(
197+
sys,
198+
configForCompilation,
199+
compilerOptionsFromCommandLine,
200+
reportDiagnostic,
201+
reportErrorSummary,
202+
testing,
203+
)
197204
watcher.start()
198205
return tsc.CommandLineResult{Status: tsc.ExitStatusSuccess, Watcher: watcher}
199206
} else if configForCompilation.CompilerOptions().IsIncremental() {

pkg/execute/watcher.go

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ import (
1414
)
1515

1616
type Watcher struct {
17-
sys tsc.System
18-
configFileName string
19-
config *tsoptions.ParsedCommandLine
20-
reportDiagnostic tsc.DiagnosticReporter
21-
reportErrorSummary tsc.DiagnosticsReporter
22-
testing tsc.CommandLineTesting
17+
sys tsc.System
18+
configFileName string
19+
config *tsoptions.ParsedCommandLine
20+
compilerOptionsFromCommandLine *core.CompilerOptions
21+
reportDiagnostic tsc.DiagnosticReporter
22+
reportErrorSummary tsc.DiagnosticsReporter
23+
testing tsc.CommandLineTesting
2324

2425
host compiler.CompilerHost
2526
program *incremental.Program
@@ -29,13 +30,21 @@ type Watcher struct {
2930

3031
var _ tsc.Watcher = (*Watcher)(nil)
3132

32-
func createWatcher(sys tsc.System, configParseResult *tsoptions.ParsedCommandLine, reportDiagnostic tsc.DiagnosticReporter, reportErrorSummary tsc.DiagnosticsReporter, testing tsc.CommandLineTesting) *Watcher {
33+
func createWatcher(
34+
sys tsc.System,
35+
configParseResult *tsoptions.ParsedCommandLine,
36+
compilerOptionsFromCommandLine *core.CompilerOptions,
37+
reportDiagnostic tsc.DiagnosticReporter,
38+
reportErrorSummary tsc.DiagnosticsReporter,
39+
testing tsc.CommandLineTesting,
40+
) *Watcher {
3341
w := &Watcher{
34-
sys: sys,
35-
config: configParseResult,
36-
reportDiagnostic: reportDiagnostic,
37-
reportErrorSummary: reportErrorSummary,
38-
testing: testing,
42+
sys: sys,
43+
config: configParseResult,
44+
compilerOptionsFromCommandLine: compilerOptionsFromCommandLine,
45+
reportDiagnostic: reportDiagnostic,
46+
reportErrorSummary: reportErrorSummary,
47+
testing: testing,
3948
// reportWatchStatus: createWatchStatusReporter(sys, configParseResult.CompilerOptions().Pretty),
4049
}
4150
if configParseResult.ConfigFile != nil {
@@ -108,7 +117,7 @@ func (w *Watcher) hasErrorsInTsConfig() bool {
108117
extendedConfigCache := &tsc.ExtendedConfigCache{}
109118
if w.configFileName != "" {
110119
// !!! need to check that this merges compileroptions correctly. This differs from non-watch, since we allow overriding of previous options
111-
configParseResult, errors := tsoptions.GetParsedCommandLineOfConfigFile(w.configFileName, &core.CompilerOptions{}, w.sys, extendedConfigCache)
120+
configParseResult, errors := tsoptions.GetParsedCommandLineOfConfigFile(w.configFileName, w.compilerOptionsFromCommandLine, w.sys, extendedConfigCache)
112121
if len(errors) > 0 {
113122
for _, e := range errors {
114123
w.reportDiagnostic(e)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
t.ts(2,14): error TS1379: An import alias cannot reference a declaration that was exported using 'export type'.
2+
3+
4+
==== t.ts (1 errors) ====
5+
import a = require("./a");
6+
import foo = a.Foo
7+
~~~~~
8+
!!! error TS1379: An import alias cannot reference a declaration that was exported using 'export type'.
9+
!!! related TS1377 a.ts:2:15: 'Foo' was exported here.
10+
11+
==== a.ts (0 errors) ====
12+
type Foo = { x: number }
13+
export type { Foo };
14+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//// [tests/cases/compiler/importAliasTypeOnlyExport.ts] ////
2+
3+
=== t.ts ===
4+
import a = require("./a");
5+
>a : Symbol(a, Decl(t.ts, 0, 0))
6+
7+
import foo = a.Foo
8+
>foo : Symbol(foo, Decl(t.ts, 0, 26))
9+
>a : Symbol(a, Decl(t.ts, 0, 0))
10+
>Foo : Symbol(a.Foo, Decl(a.ts, 1, 13))
11+
12+
=== a.ts ===
13+
type Foo = { x: number }
14+
>Foo : Symbol(Foo, Decl(a.ts, 0, 0))
15+
>x : Symbol(x, Decl(a.ts, 0, 12))
16+
17+
export type { Foo };
18+
>Foo : Symbol(Foo, Decl(a.ts, 1, 13))
19+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//// [tests/cases/compiler/importAliasTypeOnlyExport.ts] ////
2+
3+
=== t.ts ===
4+
import a = require("./a");
5+
>a : typeof a
6+
7+
import foo = a.Foo
8+
>foo : any
9+
>a : typeof a
10+
>Foo : foo
11+
12+
=== a.ts ===
13+
type Foo = { x: number }
14+
>Foo : Foo
15+
>x : number
16+
17+
export type { Foo };
18+
>Foo : Foo
19+

testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-tsconfig-and-incremental.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,45 @@ interface Symbol {
3636
declare const console: { log(msg: any): void; };
3737
//// [/home/src/workspaces/project/index.js] *new*
3838

39+
//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new*
40+
{"version":"FakeTSVersion","root":[2],"fileNames":["lib.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"99aa06d3014798d86001c324468d497f-"]}
41+
//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new*
42+
{
43+
"version": "FakeTSVersion",
44+
"root": [
45+
{
46+
"files": [
47+
"./index.ts"
48+
],
49+
"original": 2
50+
}
51+
],
52+
"fileNames": [
53+
"lib.d.ts",
54+
"./index.ts"
55+
],
56+
"fileInfos": [
57+
{
58+
"fileName": "lib.d.ts",
59+
"version": "8859c12c614ce56ba9a18e58384a198f-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
60+
"signature": "8859c12c614ce56ba9a18e58384a198f-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
61+
"affectsGlobalScope": true,
62+
"impliedNodeFormat": "CommonJS",
63+
"original": {
64+
"version": "8859c12c614ce56ba9a18e58384a198f-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };",
65+
"affectsGlobalScope": true,
66+
"impliedNodeFormat": 1
67+
}
68+
},
69+
{
70+
"fileName": "./index.ts",
71+
"version": "99aa06d3014798d86001c324468d497f-",
72+
"signature": "99aa06d3014798d86001c324468d497f-",
73+
"impliedNodeFormat": "CommonJS"
74+
}
75+
],
76+
"size": 896
77+
}
3978

4079
tsconfig.json::
4180
SemanticDiagnostics::
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @target: esnext
2+
// @module: commonjs
3+
// @noEmit: true
4+
5+
// @filename: t.ts
6+
import a = require("./a");
7+
import foo = a.Foo
8+
9+
// @filename: a.ts
10+
type Foo = { x: number }
11+
export type { Foo };

0 commit comments

Comments
 (0)