Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17746,7 +17746,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const readonly = isReadonlyTypeOperator(node.parent);
const elementType = getArrayElementTypeNode(node);
if (elementType) {
return readonly ? globalReadonlyArrayType : globalArrayType;
return (readonly ? globalReadonlyArrayType : globalArrayType) || emptyGenericType;
}
const elementFlags = map((node as TupleTypeNode).elements, getTupleElementFlags);
return getTupleTargetType(elementFlags, readonly, map((node as TupleTypeNode).elements, memberIfLabeledElementDeclaration));
Expand Down
25 changes: 25 additions & 0 deletions tests/baselines/reference/bug57009.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
error TS2317: Global type 'Array' must have 1 type parameter(s).
error TS2318: Cannot find global type 'Boolean'.
error TS2318: Cannot find global type 'CallableFunction'.
error TS2318: Cannot find global type 'Function'.
error TS2318: Cannot find global type 'IArguments'.
error TS2318: Cannot find global type 'NewableFunction'.
error TS2318: Cannot find global type 'Number'.
error TS2318: Cannot find global type 'Object'.
error TS2318: Cannot find global type 'RegExp'.
error TS2318: Cannot find global type 'String'.


!!! error TS2317: Global type 'Array' must have 1 type parameter(s).
!!! error TS2318: Cannot find global type 'Boolean'.
!!! error TS2318: Cannot find global type 'CallableFunction'.
!!! error TS2318: Cannot find global type 'Function'.
!!! error TS2318: Cannot find global type 'IArguments'.
!!! error TS2318: Cannot find global type 'NewableFunction'.
!!! error TS2318: Cannot find global type 'Number'.
!!! error TS2318: Cannot find global type 'Object'.
!!! error TS2318: Cannot find global type 'RegExp'.
!!! error TS2318: Cannot find global type 'String'.
==== bug57009.ts (0 errors) ====
type Array<T> = T[];

8 changes: 8 additions & 0 deletions tests/baselines/reference/bug57009.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//// [tests/cases/compiler/bug57009.ts] ////

//// [bug57009.ts]
type Array<T> = T[];


//// [bug57009.js]
"use strict";
8 changes: 8 additions & 0 deletions tests/baselines/reference/bug57009.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//// [tests/cases/compiler/bug57009.ts] ////

=== bug57009.ts ===
type Array<T> = T[];
>Array : Symbol(Array, Decl(bug57009.ts, 0, 0))
>T : Symbol(T, Decl(bug57009.ts, 0, 11))
>T : Symbol(T, Decl(bug57009.ts, 0, 11))

7 changes: 7 additions & 0 deletions tests/baselines/reference/bug57009.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//// [tests/cases/compiler/bug57009.ts] ////

=== bug57009.ts ===
type Array<T> = T[];
>Array : {}
> : ^^

3 changes: 3 additions & 0 deletions tests/cases/compiler/bug57009.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @noLib: true

type Array<T> = T[];