diff --git a/internal/tsoptions/parsinghelpers.go b/internal/tsoptions/parsinghelpers.go index 47a4d476bf..b540e47a04 100644 --- a/internal/tsoptions/parsinghelpers.go +++ b/internal/tsoptions/parsinghelpers.go @@ -74,11 +74,15 @@ func parseProjectReference(json any) []*core.ProjectReference { var result []*core.ProjectReference if v, ok := json.(*collections.OrderedMap[string, any]); ok { var reference core.ProjectReference - if v, ok := v.Get("path"); ok { - reference.Path = v.(string) + if pathValue, ok := v.Get("path"); ok { + if pathStr, ok := pathValue.(string); ok { + reference.Path = pathStr + } } - if v, ok := v.Get("circular"); ok { - reference.Circular = v.(bool) + if circularValue, ok := v.Get("circular"); ok { + if circularBool, ok := circularValue.(bool); ok { + reference.Circular = circularBool + } } result = append(result, &reference) } diff --git a/testdata/baselines/reference/compiler/projectReferenceNonStringPath.js b/testdata/baselines/reference/compiler/projectReferenceNonStringPath.js new file mode 100644 index 0000000000..01e7588beb --- /dev/null +++ b/testdata/baselines/reference/compiler/projectReferenceNonStringPath.js @@ -0,0 +1,8 @@ +//// [tests/cases/compiler/projectReferenceNonStringPath.ts] //// + +//// [index.ts] +export const x = 1; + + +//// [index.js] +export const x = 1; diff --git a/testdata/baselines/reference/compiler/projectReferenceNonStringPath.symbols b/testdata/baselines/reference/compiler/projectReferenceNonStringPath.symbols new file mode 100644 index 0000000000..601178d7c4 --- /dev/null +++ b/testdata/baselines/reference/compiler/projectReferenceNonStringPath.symbols @@ -0,0 +1,6 @@ +//// [tests/cases/compiler/projectReferenceNonStringPath.ts] //// + +=== /src/index.ts === +export const x = 1; +>x : Symbol(x, Decl(index.ts, 0, 12)) + diff --git a/testdata/baselines/reference/compiler/projectReferenceNonStringPath.types b/testdata/baselines/reference/compiler/projectReferenceNonStringPath.types new file mode 100644 index 0000000000..802ea8c260 --- /dev/null +++ b/testdata/baselines/reference/compiler/projectReferenceNonStringPath.types @@ -0,0 +1,7 @@ +//// [tests/cases/compiler/projectReferenceNonStringPath.ts] //// + +=== /src/index.ts === +export const x = 1; +>x : 1 +>1 : 1 + diff --git a/testdata/tests/cases/compiler/projectReferenceNonStringPath.ts b/testdata/tests/cases/compiler/projectReferenceNonStringPath.ts new file mode 100644 index 0000000000..181821407e --- /dev/null +++ b/testdata/tests/cases/compiler/projectReferenceNonStringPath.ts @@ -0,0 +1,7 @@ +// @filename: /src/tsconfig.json +{ + "references": [{ "path": true }, { "path": "./other", "circular": "yes" }] +} + +// @filename: /src/index.ts +export const x = 1;