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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14900,16 +14900,18 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
// these partial properties when identifying discriminant properties, but otherwise they are filtered out
// and do not appear to be present in the union type.
function getUnionOrIntersectionProperty(type: UnionOrIntersectionType, name: __String, skipObjectFunctionPropertyAugment?: boolean): Symbol | undefined {
let property = type.propertyCacheWithoutObjectFunctionPropertyAugment?.get(name) ||
!skipObjectFunctionPropertyAugment ? type.propertyCache?.get(name) : undefined;
let property = skipObjectFunctionPropertyAugment ?
type.propertyCacheWithoutObjectFunctionPropertyAugment?.get(name) :
type.propertyCache?.get(name);
if (!property) {
property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
if (property) {
const properties = skipObjectFunctionPropertyAugment ?
type.propertyCacheWithoutObjectFunctionPropertyAugment ||= createSymbolTable() :
type.propertyCache ||= createSymbolTable();
properties.set(name, property);
if (skipObjectFunctionPropertyAugment && !type.propertyCache?.get(name)) {
// Propagate an entry from the non-augmented cache to the augmented cache unless the property is partial.
if (skipObjectFunctionPropertyAugment && !(getCheckFlags(property) & CheckFlags.Partial) && !type.propertyCache?.get(name)) {
const properties = type.propertyCache ||= createSymbolTable();
properties.set(name, property);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Assignability cache: 2,200 / 2,200 (nearest 100)
Type Count: 7,800 / 7,800 (nearest 100)
Instantiation count: 90,000 / 90,000 (nearest 500)
Symbol count: 66,500 / 66,500 (nearest 500)
Symbol count: 67,000 / 67,000 (nearest 500)

=== checkJsxChildrenCanBeTupleType.tsx ===
/// <reference path="react16.d.ts" />
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/infiniteConstraints.types
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Assignability cache: 200 / 200 (nearest 100)
Type Count: 1,000 / 1,000 (nearest 100)
Instantiation count: 2,500 / 2,500 (nearest 500)
Symbol count: 25,500 / 26,000 (nearest 500)
Symbol count: 25,500 / 25,500 (nearest 500)

=== infiniteConstraints.ts ===
// Both of the following types trigger the recursion limiter in getImmediateBaseConstraint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
=== Performance Stats ===
Identity cache: 200 / 200 (nearest 100)
Assignability cache: 13,300 / 13,500 (nearest 100)
Type Count: 27,300 / 27,600 (nearest 100)
Type Count: 27,200 / 27,600 (nearest 100)
Instantiation count: 374,500 / 375,500 (nearest 500)
Symbol count: 92,000 / 92,000 (nearest 500)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Assignability cache: 2,200 / 2,300 (nearest 100)
Type Count: 6,900 / 7,000 (nearest 100)
Instantiation count: 73,000 / 73,500 (nearest 500)
Symbol count: 70,500 / 70,500 (nearest 500)
Symbol count: 70,500 / 71,000 (nearest 500)

=== test.tsx ===
/// <reference path="react16.d.ts" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/// <reference path="fourslash.ts" />

// @strict: true
// @lib: esnext

//// interface ComponentOptions<Props> {
//// setup?: (props: Props) => void;
//// name?: string;
//// }
////
//// interface FunctionalComponent<P> {
//// (props: P): void;
//// }
////
//// type ConcreteComponent<Props> =
//// | ComponentOptions<Props>
//// | FunctionalComponent<Props>;
////
//// type Component<Props = {}> = ConcreteComponent<Props>;
////
//// type WithInstallPlugin = { _prefix?: string };
////
////
//// /**/
//// export function withInstall<C extends Component, T extends WithInstallPlugin>(
//// component: C | C[],
//// target?: T,
//// ): string {
//// const componentWithInstall = (target ?? component) as T;
//// const components = Array.isArray(component) ? component : [component];
////
//// const { name } = components[0];
//// if (name) {
//// return name;
//// }
////
//// return "";
//// }

verify.noErrors();

goTo.marker();
edit.insert("type C = Component['name']");

verify.noErrors();