Ensure parameters are in scope when converting parameter/return types to type nodes (#49627)

This commit is contained in:
Jake Bailey 2023-02-17 16:46:03 -08:00 committed by GitHub
parent 088fdf6efe
commit 8cc216af03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1406 additions and 15 deletions

View File

@ -7276,6 +7276,86 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
const expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
// For regular function/method declarations, the enclosing declaration will already be signature.declaration,
// so this is a no-op, but for arrow functions and function expressions, the enclosing declaration will be
// the declaration that the arrow function / function expression is assigned to.
//
// If the parameters or return type include "typeof globalThis.paramName", using the wrong scope will lead
// us to believe that we can emit "typeof paramName" instead, even though that would refer to the parameter,
// not the global. Make sure we are in the right scope by changing the enclosingDeclaration to the function.
//
// We can't use the declaration directly; it may be in another file and so we may lose access to symbols
// accessible to the current enclosing declaration, or gain access to symbols not accessible to the current
// enclosing declaration. To keep this chain accurate, insert a fake scope into the chain which makes the
// function's parameters visible.
//
// If the declaration is in a JS file, then we don't need to do this at all, as there are no annotations besides
// JSDoc, which are always outside the function declaration, so are not in the parameter scope.
let cleanup: (() => void) | undefined;
if (
context.enclosingDeclaration
&& signature.declaration
&& signature.declaration !== context.enclosingDeclaration
&& !isInJSFile(signature.declaration)
&& some(expandedParams)
) {
// As a performance optimization, reuse the same fake scope within this chain.
// This is especially needed when we are working on an excessively deep type;
// if we don't do this, then we spend all of our time adding more and more
// scopes that need to be searched in isSymbolAccessible later. Since all we
// really want to do is to mark certain names as unavailable, we can just keep
// all of the names we're introducing in one large table and push/pop from it as
// needed; isSymbolAccessible will walk upward and find the closest "fake" scope,
// which will conveniently report on any and all faked scopes in the chain.
//
// It'd likely be better to store this somewhere else for isSymbolAccessible, but
// since that API _only_ uses the enclosing declaration (and its parents), this is
// seems like the best way to inject names into that search process.
//
// Note that we only check the most immediate enclosingDeclaration; the only place we
// could potentially add another fake scope into the chain is right here, so we don't
// traverse all ancestors.
const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : undefined;
Debug.assertOptionalNode(existingFakeScope, isBlock);
const locals = existingFakeScope?.locals ?? createSymbolTable();
let newLocals: __String[] | undefined;
for (const param of expandedParams) {
if (!locals.has(param.escapedName)) {
newLocals = append(newLocals, param.escapedName);
locals.set(param.escapedName, param);
}
}
if (newLocals) {
function removeNewLocals() {
forEach(newLocals, s => locals.delete(s));
}
if (existingFakeScope) {
cleanup = removeNewLocals;
}
else {
// Use a Block for this; the type of the node doesn't matter so long as it
// has locals, and this is cheaper/easier than using a function-ish Node.
const fakeScope = parseNodeFactory.createBlock(emptyArray);
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
fakeScope.locals = locals;
const saveEnclosingDeclaration = context.enclosingDeclaration;
setParent(fakeScope, saveEnclosingDeclaration);
context.enclosingDeclaration = fakeScope;
cleanup = () => {
context.enclosingDeclaration = saveEnclosingDeclaration;
removeNewLocals();
};
}
}
}
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
const parameters = (some(expandedParams, p => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & CheckFlags.RestParameter)) ? signature.parameters : expandedParams).map(parameter => symbolToParameterDeclaration(parameter, context, kind === SyntaxKind.Constructor, options?.privateSymbolVisitor, options?.bundledImports));
const thisParameter = context.flags & NodeBuilderFlags.OmitThisParameter ? undefined : tryGetThisParameterDeclaration(signature, context);
@ -7331,6 +7411,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
node.typeArguments = factory.createNodeArray(typeArguments);
}
cleanup?.();
return node;
}
@ -7996,13 +8077,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return !(getObjectFlags(type) & ObjectFlags.Reference) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount((type as TypeReference).target.typeParameters);
}
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration: Node) {
return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
}
/**
* Unlike `typeToTypeNodeHelper`, this handles setting up the `AllowUniqueESSymbolType` flag
* so a `unique symbol` is returned when appropriate for the input symbol, rather than `typeof sym`
*/
function serializeTypeForDeclaration(context: NodeBuilderContext, type: Type, symbol: Symbol, enclosingDeclaration: Node | undefined, includePrivateSymbol?: (s: Symbol) => void, bundled?: boolean) {
if (!isErrorType(type) && enclosingDeclaration) {
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
// try to reuse the existing annotation
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation)!;
@ -8038,7 +8123,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
function serializeReturnTypeForSignature(context: NodeBuilderContext, type: Type, signature: Signature, includePrivateSymbol?: (s: Symbol) => void, bundled?: boolean) {
if (!isErrorType(type) && context.enclosingDeclaration) {
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
if (!!findAncestor(annotation, n => n === context.enclosingDeclaration) && annotation) {
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
if (!!findAncestor(annotation, n => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
const annotated = getTypeFromTypeNode(annotation);
const thisInstantiated = annotated.flags & TypeFlags.TypeParameter && (annotated as TypeParameter).isThisType ? instantiateType(annotated, signature.mapper) : annotated;
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {

View File

@ -5997,6 +5997,7 @@ export interface NodeLinks {
serializedTypes?: Map<string, SerializedTypeEntry>; // Collection of types serialized at this location
decoratorSignature?: Signature; // Signature for decorator as if invoked by the runtime.
parameterInitializerContainsUndefined?: boolean; // True if this is a parameter declaration whose type annotation contains "undefined".
fakeScopeForSignatureDeclaration?: boolean; // True if this is a fake scope injected into an enclosing declaration chain.
}
/** @internal */

View File

@ -0,0 +1,170 @@
//// [declarationEmitGlobalThisPreserved.ts]
// Adding this makes tooltips fail too.
// declare global {
// namespace isNaN {
// const prop: number;
// }
// }
// Broken inference cases.
export const a1 = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN;
export const a2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN;
export const a3 = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar;
export const a4 = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN;
export const aObj = {
a1: (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN,
a2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN,
a3: (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar,
a4: (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN,
}
export type a4Return = ReturnType<ReturnType<typeof a4>>;
export type a4oReturn = ReturnType<ReturnType<typeof aObj['a4']>>;
export const b1 = (isNaN: typeof globalThis.isNaN) => isNaN;
export const b2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN;
export const b3 = (isNaN: number, bar: typeof globalThis.isNaN) => bar;
export const b4 = (isNaN: number) => globalThis.isNaN;
export const bObj = {
b1: (isNaN: typeof globalThis.isNaN) => isNaN,
b2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN,
b3: (isNaN: number, bar: typeof globalThis.isNaN) => bar,
b4: (isNaN: number) => globalThis.isNaN,
}
export type b4Return = ReturnType<ReturnType<typeof b4>>;
export type b4oReturn = ReturnType<ReturnType<typeof bObj['b4']>>;
export function c1(isNaN: typeof globalThis.isNaN) { return isNaN }
export function c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN }
export function c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar }
export function c4(isNaN: number) { return globalThis.isNaN; }
export const cObj = {
c1(isNaN: typeof globalThis.isNaN) { return isNaN },
c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN },
c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar },
c4(isNaN: number) { return globalThis.isNaN; },
}
export type c4Return = ReturnType<ReturnType<typeof c4>>;
export type c4oReturn = ReturnType<ReturnType<typeof cObj['c4']>>;
export function d1() {
const fn = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN;
return function() { return fn };
}
export function d2() {
const fn = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN;
return function() { return fn };
}
export function d3() {
const fn = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar;
return function() { return fn };
}
export function d4() {
const fn = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN;
return function() { return fn };
}
export type d4Return = ReturnType<ReturnType<ReturnType<ReturnType<typeof d4>>>>;
export class A {
method1(isNaN: typeof globalThis.isNaN) { return isNaN }
method2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN }
method3(isNaN: number, bar: typeof globalThis.isNaN) { return bar }
method4(isNaN: number) { return globalThis.isNaN; }
}
export function fromParameter(isNaN: number, bar: typeof globalThis.isNaN) {
return function() { return { bar } };
}
// Non-inference cases.
export const explicitlyTypedVariable: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN = (isNaN) => isNaN;
export function explicitlyTypedFunction(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN {
return isNaN;
};
export type AsObjectProperty = {
isNaN: typeof globalThis.isNaN;
}
export class AsClassProperty {
isNaN?: typeof globalThis.isNaN;
}
export type AsFunctionType = (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;
//// [declarationEmitGlobalThisPreserved.d.ts]
export declare const a1: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;
export declare const a2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => typeof globalThis.isNaN;
export declare const a3: (isNaN: number, bar: typeof globalThis.isNaN) => typeof globalThis.isNaN;
export declare const a4: (isNaN: number) => typeof globalThis.isNaN;
export declare const aObj: {
a1: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;
a2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => typeof globalThis.isNaN;
a3: (isNaN: number, bar: typeof globalThis.isNaN) => typeof globalThis.isNaN;
a4: (isNaN: number) => typeof globalThis.isNaN;
};
export type a4Return = ReturnType<ReturnType<typeof a4>>;
export type a4oReturn = ReturnType<ReturnType<typeof aObj['a4']>>;
export declare const b1: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;
export declare const b2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => typeof globalThis.isNaN;
export declare const b3: (isNaN: number, bar: typeof globalThis.isNaN) => typeof globalThis.isNaN;
export declare const b4: (isNaN: number) => typeof globalThis.isNaN;
export declare const bObj: {
b1: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;
b2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => typeof globalThis.isNaN;
b3: (isNaN: number, bar: typeof globalThis.isNaN) => typeof globalThis.isNaN;
b4: (isNaN: number) => typeof globalThis.isNaN;
};
export type b4Return = ReturnType<ReturnType<typeof b4>>;
export type b4oReturn = ReturnType<ReturnType<typeof bObj['b4']>>;
export declare function c1(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN;
export declare function c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN;
export declare function c3(isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN;
export declare function c4(isNaN: number): typeof globalThis.isNaN;
export declare const cObj: {
c1(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN;
c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN;
c3(isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN;
c4(isNaN: number): typeof globalThis.isNaN;
};
export type c4Return = ReturnType<ReturnType<typeof c4>>;
export type c4oReturn = ReturnType<ReturnType<typeof cObj['c4']>>;
export declare function d1(): () => (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;
export declare function d2(): () => (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => typeof globalThis.isNaN;
export declare function d3(): () => (isNaN: number, bar: typeof globalThis.isNaN) => typeof globalThis.isNaN;
export declare function d4(): () => (isNaN: number) => typeof globalThis.isNaN;
export type d4Return = ReturnType<ReturnType<ReturnType<ReturnType<typeof d4>>>>;
export declare class A {
method1(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN;
method2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN;
method3(isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN;
method4(isNaN: number): typeof globalThis.isNaN;
}
export declare function fromParameter(isNaN: number, bar: typeof globalThis.isNaN): () => {
bar: typeof globalThis.isNaN;
};
export declare const explicitlyTypedVariable: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;
export declare function explicitlyTypedFunction(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN;
export type AsObjectProperty = {
isNaN: typeof globalThis.isNaN;
};
export declare class AsClassProperty {
isNaN?: typeof globalThis.isNaN;
}
export type AsFunctionType = (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;

View File

@ -0,0 +1,502 @@
=== tests/cases/compiler/declarationEmitGlobalThisPreserved.ts ===
// Adding this makes tooltips fail too.
// declare global {
// namespace isNaN {
// const prop: number;
// }
// }
// Broken inference cases.
export const a1 = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN;
>a1 : Symbol(a1, Decl(declarationEmitGlobalThisPreserved.ts, 9, 12))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 9, 19))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 9, 19))
export const a2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN;
>a2 : Symbol(a2, Decl(declarationEmitGlobalThisPreserved.ts, 10, 12))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 10, 19))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 10, 50))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 10, 50))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 10, 19))
export const a3 = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar;
>a3 : Symbol(a3, Decl(declarationEmitGlobalThisPreserved.ts, 11, 12))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 11, 19))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 11, 33))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 11, 33))
export const a4 = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN;
>a4 : Symbol(a4, Decl(declarationEmitGlobalThisPreserved.ts, 12, 12))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 12, 19))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
export const aObj = {
>aObj : Symbol(aObj, Decl(declarationEmitGlobalThisPreserved.ts, 14, 12))
a1: (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN,
>a1 : Symbol(a1, Decl(declarationEmitGlobalThisPreserved.ts, 14, 21))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 15, 9))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 15, 9))
a2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN,
>a2 : Symbol(a2, Decl(declarationEmitGlobalThisPreserved.ts, 15, 75))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 16, 9))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 16, 40))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 16, 40))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 16, 9))
a3: (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar,
>a3 : Symbol(a3, Decl(declarationEmitGlobalThisPreserved.ts, 16, 113))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 17, 9))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 17, 23))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 17, 23))
a4: (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN,
>a4 : Symbol(a4, Decl(declarationEmitGlobalThisPreserved.ts, 17, 86))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 18, 9))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
}
export type a4Return = ReturnType<ReturnType<typeof a4>>;
>a4Return : Symbol(a4Return, Decl(declarationEmitGlobalThisPreserved.ts, 19, 1))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>a4 : Symbol(a4, Decl(declarationEmitGlobalThisPreserved.ts, 12, 12))
export type a4oReturn = ReturnType<ReturnType<typeof aObj['a4']>>;
>a4oReturn : Symbol(a4oReturn, Decl(declarationEmitGlobalThisPreserved.ts, 21, 57))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>aObj : Symbol(aObj, Decl(declarationEmitGlobalThisPreserved.ts, 14, 12))
export const b1 = (isNaN: typeof globalThis.isNaN) => isNaN;
>b1 : Symbol(b1, Decl(declarationEmitGlobalThisPreserved.ts, 24, 12))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 24, 19))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 24, 19))
export const b2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN;
>b2 : Symbol(b2, Decl(declarationEmitGlobalThisPreserved.ts, 25, 12))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 25, 19))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 25, 50))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 25, 50))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 25, 19))
export const b3 = (isNaN: number, bar: typeof globalThis.isNaN) => bar;
>b3 : Symbol(b3, Decl(declarationEmitGlobalThisPreserved.ts, 26, 12))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 26, 19))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 26, 33))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 26, 33))
export const b4 = (isNaN: number) => globalThis.isNaN;
>b4 : Symbol(b4, Decl(declarationEmitGlobalThisPreserved.ts, 27, 12))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 27, 19))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
export const bObj = {
>bObj : Symbol(bObj, Decl(declarationEmitGlobalThisPreserved.ts, 29, 12))
b1: (isNaN: typeof globalThis.isNaN) => isNaN,
>b1 : Symbol(b1, Decl(declarationEmitGlobalThisPreserved.ts, 29, 21))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 30, 9))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 30, 9))
b2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN,
>b2 : Symbol(b2, Decl(declarationEmitGlobalThisPreserved.ts, 30, 50))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 31, 9))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 31, 40))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 31, 40))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 31, 9))
b3: (isNaN: number, bar: typeof globalThis.isNaN) => bar,
>b3 : Symbol(b3, Decl(declarationEmitGlobalThisPreserved.ts, 31, 88))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 32, 9))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 32, 23))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 32, 23))
b4: (isNaN: number) => globalThis.isNaN,
>b4 : Symbol(b4, Decl(declarationEmitGlobalThisPreserved.ts, 32, 61))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 33, 9))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
}
export type b4Return = ReturnType<ReturnType<typeof b4>>;
>b4Return : Symbol(b4Return, Decl(declarationEmitGlobalThisPreserved.ts, 34, 1))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>b4 : Symbol(b4, Decl(declarationEmitGlobalThisPreserved.ts, 27, 12))
export type b4oReturn = ReturnType<ReturnType<typeof bObj['b4']>>;
>b4oReturn : Symbol(b4oReturn, Decl(declarationEmitGlobalThisPreserved.ts, 36, 57))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>bObj : Symbol(bObj, Decl(declarationEmitGlobalThisPreserved.ts, 29, 12))
export function c1(isNaN: typeof globalThis.isNaN) { return isNaN }
>c1 : Symbol(c1, Decl(declarationEmitGlobalThisPreserved.ts, 37, 66))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 39, 19))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 39, 19))
export function c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN }
>c2 : Symbol(c2, Decl(declarationEmitGlobalThisPreserved.ts, 39, 67))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 40, 19))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 40, 50))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 40, 50))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 40, 19))
export function c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar }
>c3 : Symbol(c3, Decl(declarationEmitGlobalThisPreserved.ts, 40, 105))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 41, 19))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 41, 33))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 41, 33))
export function c4(isNaN: number) { return globalThis.isNaN; }
>c4 : Symbol(c4, Decl(declarationEmitGlobalThisPreserved.ts, 41, 78))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 42, 19))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
export const cObj = {
>cObj : Symbol(cObj, Decl(declarationEmitGlobalThisPreserved.ts, 44, 12))
c1(isNaN: typeof globalThis.isNaN) { return isNaN },
>c1 : Symbol(c1, Decl(declarationEmitGlobalThisPreserved.ts, 44, 21))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 45, 7))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 45, 7))
c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN },
>c2 : Symbol(c2, Decl(declarationEmitGlobalThisPreserved.ts, 45, 56))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 46, 7))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 46, 38))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 46, 38))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 46, 7))
c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar },
>c3 : Symbol(c3, Decl(declarationEmitGlobalThisPreserved.ts, 46, 94))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 47, 7))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 47, 21))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 47, 21))
c4(isNaN: number) { return globalThis.isNaN; },
>c4 : Symbol(c4, Decl(declarationEmitGlobalThisPreserved.ts, 47, 67))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 48, 7))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
}
export type c4Return = ReturnType<ReturnType<typeof c4>>;
>c4Return : Symbol(c4Return, Decl(declarationEmitGlobalThisPreserved.ts, 49, 1))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>c4 : Symbol(c4, Decl(declarationEmitGlobalThisPreserved.ts, 41, 78))
export type c4oReturn = ReturnType<ReturnType<typeof cObj['c4']>>;
>c4oReturn : Symbol(c4oReturn, Decl(declarationEmitGlobalThisPreserved.ts, 51, 57))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>cObj : Symbol(cObj, Decl(declarationEmitGlobalThisPreserved.ts, 44, 12))
export function d1() {
>d1 : Symbol(d1, Decl(declarationEmitGlobalThisPreserved.ts, 52, 66))
const fn = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN;
>fn : Symbol(fn, Decl(declarationEmitGlobalThisPreserved.ts, 55, 9))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 55, 16))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 55, 16))
return function() { return fn };
>fn : Symbol(fn, Decl(declarationEmitGlobalThisPreserved.ts, 55, 9))
}
export function d2() {
>d2 : Symbol(d2, Decl(declarationEmitGlobalThisPreserved.ts, 57, 1))
const fn = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN;
>fn : Symbol(fn, Decl(declarationEmitGlobalThisPreserved.ts, 60, 9))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 60, 16))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 60, 47))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 60, 47))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 60, 16))
return function() { return fn };
>fn : Symbol(fn, Decl(declarationEmitGlobalThisPreserved.ts, 60, 9))
}
export function d3() {
>d3 : Symbol(d3, Decl(declarationEmitGlobalThisPreserved.ts, 62, 1))
const fn = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar;
>fn : Symbol(fn, Decl(declarationEmitGlobalThisPreserved.ts, 65, 9))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 65, 16))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 65, 30))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 65, 30))
return function() { return fn };
>fn : Symbol(fn, Decl(declarationEmitGlobalThisPreserved.ts, 65, 9))
}
export function d4() {
>d4 : Symbol(d4, Decl(declarationEmitGlobalThisPreserved.ts, 67, 1))
const fn = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN;
>fn : Symbol(fn, Decl(declarationEmitGlobalThisPreserved.ts, 70, 9))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 70, 16))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
return function() { return fn };
>fn : Symbol(fn, Decl(declarationEmitGlobalThisPreserved.ts, 70, 9))
}
export type d4Return = ReturnType<ReturnType<ReturnType<ReturnType<typeof d4>>>>;
>d4Return : Symbol(d4Return, Decl(declarationEmitGlobalThisPreserved.ts, 72, 1))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
>d4 : Symbol(d4, Decl(declarationEmitGlobalThisPreserved.ts, 67, 1))
export class A {
>A : Symbol(A, Decl(declarationEmitGlobalThisPreserved.ts, 74, 81))
method1(isNaN: typeof globalThis.isNaN) { return isNaN }
>method1 : Symbol(A.method1, Decl(declarationEmitGlobalThisPreserved.ts, 76, 16))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 77, 12))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 77, 12))
method2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN }
>method2 : Symbol(A.method2, Decl(declarationEmitGlobalThisPreserved.ts, 77, 60))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 78, 12))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 78, 43))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 78, 43))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 78, 12))
method3(isNaN: number, bar: typeof globalThis.isNaN) { return bar }
>method3 : Symbol(A.method3, Decl(declarationEmitGlobalThisPreserved.ts, 78, 98))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 79, 12))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 79, 26))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 79, 26))
method4(isNaN: number) { return globalThis.isNaN; }
>method4 : Symbol(A.method4, Decl(declarationEmitGlobalThisPreserved.ts, 79, 71))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 80, 12))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
}
export function fromParameter(isNaN: number, bar: typeof globalThis.isNaN) {
>fromParameter : Symbol(fromParameter, Decl(declarationEmitGlobalThisPreserved.ts, 81, 1))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 83, 30))
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 83, 44))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
return function() { return { bar } };
>bar : Symbol(bar, Decl(declarationEmitGlobalThisPreserved.ts, 84, 32))
}
// Non-inference cases.
export const explicitlyTypedVariable: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN = (isNaN) => isNaN;
>explicitlyTypedVariable : Symbol(explicitlyTypedVariable, Decl(declarationEmitGlobalThisPreserved.ts, 89, 12))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 89, 39))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 89, 101))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 89, 101))
export function explicitlyTypedFunction(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN {
>explicitlyTypedFunction : Symbol(explicitlyTypedFunction, Decl(declarationEmitGlobalThisPreserved.ts, 89, 117))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 91, 40))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
return isNaN;
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 91, 40))
};
export type AsObjectProperty = {
>AsObjectProperty : Symbol(AsObjectProperty, Decl(declarationEmitGlobalThisPreserved.ts, 93, 2))
isNaN: typeof globalThis.isNaN;
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 95, 32))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
}
export class AsClassProperty {
>AsClassProperty : Symbol(AsClassProperty, Decl(declarationEmitGlobalThisPreserved.ts, 97, 1))
isNaN?: typeof globalThis.isNaN;
>isNaN : Symbol(AsClassProperty.isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 99, 30))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
}
export type AsFunctionType = (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;
>AsFunctionType : Symbol(AsFunctionType, Decl(declarationEmitGlobalThisPreserved.ts, 101, 1))
>isNaN : Symbol(isNaN, Decl(declarationEmitGlobalThisPreserved.ts, 103, 30))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis.isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>isNaN : Symbol(isNaN, Decl(lib.es5.d.ts, --, --))

View File

@ -0,0 +1,524 @@
=== tests/cases/compiler/declarationEmitGlobalThisPreserved.ts ===
// Adding this makes tooltips fail too.
// declare global {
// namespace isNaN {
// const prop: number;
// }
// }
// Broken inference cases.
export const a1 = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN;
>a1 : (isNaN: (number: number) => boolean) => (number: number) => boolean
>(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN : (isNaN: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>isNaN : (number: number) => boolean
export const a2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN;
>a2 : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar ?? isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>isNaN : (number: number) => boolean
export const a3 = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar;
>a3 : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>(isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>isNaN : number
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
export const a4 = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN;
>a4 : (isNaN: number) => (number: number) => boolean
>(isNaN: number): typeof globalThis.isNaN => globalThis.isNaN : (isNaN: number) => (number: number) => boolean
>isNaN : number
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
export const aObj = {
>aObj : { a1: (isNaN: (number: number) => boolean) => (number: number) => boolean; a2: (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean; a3: (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean; a4: (isNaN: number) => (number: number) => boolean; }
>{ a1: (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN, a2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN, a3: (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar, a4: (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN,} : { a1: (isNaN: (number: number) => boolean) => (number: number) => boolean; a2: (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean; a3: (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean; a4: (isNaN: number) => (number: number) => boolean; }
a1: (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN,
>a1 : (isNaN: (number: number) => boolean) => (number: number) => boolean
>(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN : (isNaN: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>isNaN : (number: number) => boolean
a2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN,
>a2 : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar ?? isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>isNaN : (number: number) => boolean
a3: (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar,
>a3 : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>(isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>isNaN : number
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
a4: (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN,
>a4 : (isNaN: number) => (number: number) => boolean
>(isNaN: number): typeof globalThis.isNaN => globalThis.isNaN : (isNaN: number) => (number: number) => boolean
>isNaN : number
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
}
export type a4Return = ReturnType<ReturnType<typeof a4>>;
>a4Return : boolean
>a4 : (isNaN: number) => (number: number) => boolean
export type a4oReturn = ReturnType<ReturnType<typeof aObj['a4']>>;
>a4oReturn : boolean
>aObj : { a1: (isNaN: (number: number) => boolean) => (number: number) => boolean; a2: (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean; a3: (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean; a4: (isNaN: number) => (number: number) => boolean; }
export const b1 = (isNaN: typeof globalThis.isNaN) => isNaN;
>b1 : (isNaN: (number: number) => boolean) => (number: number) => boolean
>(isNaN: typeof globalThis.isNaN) => isNaN : (isNaN: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>isNaN : (number: number) => boolean
export const b2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN;
>b2 : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar ?? isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>isNaN : (number: number) => boolean
export const b3 = (isNaN: number, bar: typeof globalThis.isNaN) => bar;
>b3 : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>(isNaN: number, bar: typeof globalThis.isNaN) => bar : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>isNaN : number
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
export const b4 = (isNaN: number) => globalThis.isNaN;
>b4 : (isNaN: number) => (number: number) => boolean
>(isNaN: number) => globalThis.isNaN : (isNaN: number) => (number: number) => boolean
>isNaN : number
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
export const bObj = {
>bObj : { b1: (isNaN: (number: number) => boolean) => (number: number) => boolean; b2: (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean; b3: (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean; b4: (isNaN: number) => (number: number) => boolean; }
>{ b1: (isNaN: typeof globalThis.isNaN) => isNaN, b2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN, b3: (isNaN: number, bar: typeof globalThis.isNaN) => bar, b4: (isNaN: number) => globalThis.isNaN,} : { b1: (isNaN: (number: number) => boolean) => (number: number) => boolean; b2: (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean; b3: (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean; b4: (isNaN: number) => (number: number) => boolean; }
b1: (isNaN: typeof globalThis.isNaN) => isNaN,
>b1 : (isNaN: (number: number) => boolean) => (number: number) => boolean
>(isNaN: typeof globalThis.isNaN) => isNaN : (isNaN: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>isNaN : (number: number) => boolean
b2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN,
>b2 : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar ?? isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>isNaN : (number: number) => boolean
b3: (isNaN: number, bar: typeof globalThis.isNaN) => bar,
>b3 : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>(isNaN: number, bar: typeof globalThis.isNaN) => bar : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>isNaN : number
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
b4: (isNaN: number) => globalThis.isNaN,
>b4 : (isNaN: number) => (number: number) => boolean
>(isNaN: number) => globalThis.isNaN : (isNaN: number) => (number: number) => boolean
>isNaN : number
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
}
export type b4Return = ReturnType<ReturnType<typeof b4>>;
>b4Return : boolean
>b4 : (isNaN: number) => (number: number) => boolean
export type b4oReturn = ReturnType<ReturnType<typeof bObj['b4']>>;
>b4oReturn : boolean
>bObj : { b1: (isNaN: (number: number) => boolean) => (number: number) => boolean; b2: (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean; b3: (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean; b4: (isNaN: number) => (number: number) => boolean; }
export function c1(isNaN: typeof globalThis.isNaN) { return isNaN }
>c1 : (isNaN: typeof globalThis.isNaN) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>isNaN : (number: number) => boolean
export function c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN }
>c2 : (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar ?? isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>isNaN : (number: number) => boolean
export function c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar }
>c3 : (isNaN: number, bar: typeof globalThis.isNaN) => (number: number) => boolean
>isNaN : number
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
export function c4(isNaN: number) { return globalThis.isNaN; }
>c4 : (isNaN: number) => (number: number) => boolean
>isNaN : number
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
export const cObj = {
>cObj : { c1(isNaN: (number: number) => boolean): (number: number) => boolean; c2(isNaN: (number: number) => boolean, bar?: (number: number) => boolean): (number: number) => boolean; c3(isNaN: number, bar: (number: number) => boolean): (number: number) => boolean; c4(isNaN: number): (number: number) => boolean; }
>{ c1(isNaN: typeof globalThis.isNaN) { return isNaN }, c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN }, c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar }, c4(isNaN: number) { return globalThis.isNaN; },} : { c1(isNaN: (number: number) => boolean): (number: number) => boolean; c2(isNaN: (number: number) => boolean, bar?: (number: number) => boolean): (number: number) => boolean; c3(isNaN: number, bar: (number: number) => boolean): (number: number) => boolean; c4(isNaN: number): (number: number) => boolean; }
c1(isNaN: typeof globalThis.isNaN) { return isNaN },
>c1 : (isNaN: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>isNaN : (number: number) => boolean
c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN },
>c2 : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar ?? isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>isNaN : (number: number) => boolean
c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar },
>c3 : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>isNaN : number
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
c4(isNaN: number) { return globalThis.isNaN; },
>c4 : (isNaN: number) => (number: number) => boolean
>isNaN : number
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
}
export type c4Return = ReturnType<ReturnType<typeof c4>>;
>c4Return : boolean
>c4 : (isNaN: number) => (number: number) => boolean
export type c4oReturn = ReturnType<ReturnType<typeof cObj['c4']>>;
>c4oReturn : boolean
>cObj : { c1(isNaN: (number: number) => boolean): (number: number) => boolean; c2(isNaN: (number: number) => boolean, bar?: (number: number) => boolean): (number: number) => boolean; c3(isNaN: number, bar: (number: number) => boolean): (number: number) => boolean; c4(isNaN: number): (number: number) => boolean; }
export function d1() {
>d1 : () => () => (isNaN: (number: number) => boolean) => (number: number) => boolean
const fn = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN;
>fn : (isNaN: (number: number) => boolean) => (number: number) => boolean
>(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN : (isNaN: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>isNaN : (number: number) => boolean
return function() { return fn };
>function() { return fn } : () => (isNaN: (number: number) => boolean) => (number: number) => boolean
>fn : (isNaN: (number: number) => boolean) => (number: number) => boolean
}
export function d2() {
>d2 : () => () => (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
const fn = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN;
>fn : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar ?? isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>isNaN : (number: number) => boolean
return function() { return fn };
>function() { return fn } : () => (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
>fn : (isNaN: (number: number) => boolean, bar?: (number: number) => boolean) => (number: number) => boolean
}
export function d3() {
>d3 : () => () => (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
const fn = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar;
>fn : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>(isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>isNaN : number
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
return function() { return fn };
>function() { return fn } : () => (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
>fn : (isNaN: number, bar: (number: number) => boolean) => (number: number) => boolean
}
export function d4() {
>d4 : () => () => (isNaN: number) => (number: number) => boolean
const fn = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN;
>fn : (isNaN: number) => (number: number) => boolean
>(isNaN: number): typeof globalThis.isNaN => globalThis.isNaN : (isNaN: number) => (number: number) => boolean
>isNaN : number
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
return function() { return fn };
>function() { return fn } : () => (isNaN: number) => (number: number) => boolean
>fn : (isNaN: number) => (number: number) => boolean
}
export type d4Return = ReturnType<ReturnType<ReturnType<ReturnType<typeof d4>>>>;
>d4Return : boolean
>d4 : () => () => (isNaN: number) => (number: number) => boolean
export class A {
>A : A
method1(isNaN: typeof globalThis.isNaN) { return isNaN }
>method1 : (isNaN: typeof globalThis.isNaN) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>isNaN : (number: number) => boolean
method2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN }
>method2 : (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => (number: number) => boolean
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar ?? isNaN : (number: number) => boolean
>bar : (number: number) => boolean
>isNaN : (number: number) => boolean
method3(isNaN: number, bar: typeof globalThis.isNaN) { return bar }
>method3 : (isNaN: number, bar: typeof globalThis.isNaN) => (number: number) => boolean
>isNaN : number
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>bar : (number: number) => boolean
method4(isNaN: number) { return globalThis.isNaN; }
>method4 : (isNaN: number) => (number: number) => boolean
>isNaN : number
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
}
export function fromParameter(isNaN: number, bar: typeof globalThis.isNaN) {
>fromParameter : (isNaN: number, bar: typeof globalThis.isNaN) => () => { bar: (number: number) => boolean; }
>isNaN : number
>bar : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
return function() { return { bar } };
>function() { return { bar } } : () => { bar: (number: number) => boolean; }
>{ bar } : { bar: (number: number) => boolean; }
>bar : (number: number) => boolean
}
// Non-inference cases.
export const explicitlyTypedVariable: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN = (isNaN) => isNaN;
>explicitlyTypedVariable : (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>(isNaN) => isNaN : (isNaN: (number: number) => boolean) => (number: number) => boolean
>isNaN : (number: number) => boolean
>isNaN : (number: number) => boolean
export function explicitlyTypedFunction(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN {
>explicitlyTypedFunction : (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
return isNaN;
>isNaN : (number: number) => boolean
};
export type AsObjectProperty = {
>AsObjectProperty : { isNaN: typeof globalThis.isNaN; }
isNaN: typeof globalThis.isNaN;
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
}
export class AsClassProperty {
>AsClassProperty : AsClassProperty
isNaN?: typeof globalThis.isNaN;
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
}
export type AsFunctionType = (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;
>AsFunctionType : (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean
>globalThis.isNaN : (number: number) => boolean
>globalThis : typeof globalThis
>isNaN : (number: number) => boolean

View File

@ -155,7 +155,7 @@ let p2 = p1.deeper({ two: '2' })
>p1.deeper({ two: '2' }) : { result: { one: string; } & { two: string; }; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => any; }; }; }; }; }; }; }; }; }; }; }
>p1.deeper : <U extends Object>(child: U) => { result: { one: string; } & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U & U & U & U; deeper: any; }; }; }; }; }; }; }; }; }; }; }
>p1 : { result: { one: string; }; deeper: <U extends Object>(child: U) => { result: { one: string; } & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => any; }; }; }; }; }; }; }; }; }; }; }
>deeper : <U extends Object>(child: U) => { result: { one: string; } & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => any; }; }; }; }; }; }; }; }; }; }
>deeper : <U extends Object>(child: U) => { result: { one: string; } & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & U & U & U & U & U & U & U & U & U & U & U; deeper: any; }; }; }; }; }; }; }; }; }; }; }
>{ two: '2' } : { two: string; }
>two : string
>'2' : "2"
@ -181,7 +181,7 @@ let p3 = p2.deeper({ three: '3' })
>p2.deeper({ three: '3' }) : { result: { one: string; } & { two: string; } & { three: string; }; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & { three: string; } & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & { three: string; } & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & { three: string; } & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & { three: string; } & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & { three: string; } & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & { three: string; } & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & { three: string; } & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & { three: string; } & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & { three: string; } & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & { three: string; } & U & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => any; }; }; }; }; }; }; }; }; }; }; }
>p2.deeper : <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U & U & U; deeper: any; }; }; }; }; }; }; }; }; }; }; }
>p2 : { result: { one: string; } & { two: string; }; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => any; }; }; }; }; }; }; }; }; }; }; }
>deeper : <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => any; }; }; }; }; }; }; }; }; }; }
>deeper : <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U & U; deeper: <U extends Object>(child: U) => { result: { one: string; } & { two: string; } & U & U & U & U & U & U & U & U & U & U & U; deeper: any; }; }; }; }; }; }; }; }; }; }; }
>{ three: '3' } : { three: string; }
>three : string
>'3' : "3"

View File

@ -1,7 +1,7 @@
=== tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts ===
interface I {
f: (a: { a: number }) => void
>f : (a: { a: number; }) => void
>f : (a: { a: number;}) => void
>a : { a: number; }
>a : number
}

View File

@ -6,7 +6,7 @@
// back if contextual typing is not taking effect.
type FuncType = (x: <T>(p: T) => T) => typeof x;
>FuncType : (x: <T>(p: T) => T) => <T>(p: T) => T
>FuncType : (x: <T>(p: T) => T) => typeof x
>x : <T>(p: T) => T
>p : T
>x : <T>(p: T) => T

View File

@ -66,7 +66,7 @@ var h = h();
>h : () => any
var i: (x: typeof i) => typeof x;
>i : (x: typeof i) => any
>i : (x: typeof i) => typeof x
>x : (x: typeof i) => any
>i : (x: any) => any
>x : (x: any) => typeof x
@ -99,7 +99,7 @@ var h2 = new h2();
>h2 : new () => any
var i2: new (x: typeof i2) => typeof x;
>i2 : new (x: typeof i2) => any
>i2 : new (x: typeof i2) => typeof x
>x : new (x: typeof i2) => any
>i2 : new (x: any) => any
>x : new (x: any) => typeof x

View File

@ -1,6 +1,6 @@
=== tests/cases/conformance/expressions/contextualTyping/taggedTemplateContextualTyping1.ts ===
type FuncType = (x: <T>(p: T) => T) => typeof x;
>FuncType : (x: <T>(p: T) => T) => <T>(p: T) => T
>FuncType : (x: <T>(p: T) => T) => typeof x
>x : <T>(p: T) => T
>p : T
>x : <T>(p: T) => T

View File

@ -1,12 +1,12 @@
=== tests/cases/conformance/expressions/contextualTyping/taggedTemplateContextualTyping2.ts ===
type FuncType1 = (x: <T>(p: T) => T) => typeof x;
>FuncType1 : (x: <T>(p: T) => T) => <T>(p: T) => T
>FuncType1 : (x: <T>(p: T) => T) => typeof x
>x : <T>(p: T) => T
>p : T
>x : <T>(p: T) => T
type FuncType2 = (x: <S, T>(p: T) => T) => typeof x;
>FuncType2 : (x: <S, T>(p: T) => T) => <S, T>(p: T) => T
>FuncType2 : (x: <S, T>(p: T) => T) => typeof x
>x : <S, T>(p: T) => T
>p : T
>x : <S, T>(p: T) => T

View File

@ -1,6 +1,6 @@
=== tests/cases/compiler/targetTypeCastTest.ts ===
declare var Point: { new(x:number, y:number): {x: number; y: number; }; }
>Point : new (x: number, y: number) => { x: number; y: number; }
>Point : new (x: number, y: number) => { x: number; y: number;}
>x : number
>y : number
>x : number

View File

@ -3,8 +3,8 @@ class foo<T> {
>foo : foo<T>
static M(x: (x: T) => { x: { y: T } }) {
>M : (x: (x: T) => { x: { y: T;}; }) => void
>x : (x: T) => { x: { y: T;}; }
>M : (x: (x: T) => { x: { y: T; };}) => void
>x : (x: T) => { x: { y: T; };}
>x : T
>x : { y: T; }
>y : T

View File

@ -121,7 +121,7 @@ var n4: {
}[];
var d4: {
>d4 : { foo(n: string, x: { x: number; y: number; }): { x: number; y: number; }; }
>d4 : { foo(n: string, x: { x: number; y: number;}): { x: number; y: number;}; }
foo(n: string, x: { x: number; y: number; }): {
>foo : (n: string, x: { x: number; y: number;}) => { x: number; y: number;}

View File

@ -0,0 +1,108 @@
// @declaration: true
// @emitDeclarationOnly: true
// Adding this makes tooltips fail too.
// declare global {
// namespace isNaN {
// const prop: number;
// }
// }
// Broken inference cases.
export const a1 = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN;
export const a2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN;
export const a3 = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar;
export const a4 = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN;
export const aObj = {
a1: (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN,
a2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN,
a3: (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar,
a4: (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN,
}
export type a4Return = ReturnType<ReturnType<typeof a4>>;
export type a4oReturn = ReturnType<ReturnType<typeof aObj['a4']>>;
export const b1 = (isNaN: typeof globalThis.isNaN) => isNaN;
export const b2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN;
export const b3 = (isNaN: number, bar: typeof globalThis.isNaN) => bar;
export const b4 = (isNaN: number) => globalThis.isNaN;
export const bObj = {
b1: (isNaN: typeof globalThis.isNaN) => isNaN,
b2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN,
b3: (isNaN: number, bar: typeof globalThis.isNaN) => bar,
b4: (isNaN: number) => globalThis.isNaN,
}
export type b4Return = ReturnType<ReturnType<typeof b4>>;
export type b4oReturn = ReturnType<ReturnType<typeof bObj['b4']>>;
export function c1(isNaN: typeof globalThis.isNaN) { return isNaN }
export function c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN }
export function c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar }
export function c4(isNaN: number) { return globalThis.isNaN; }
export const cObj = {
c1(isNaN: typeof globalThis.isNaN) { return isNaN },
c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN },
c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar },
c4(isNaN: number) { return globalThis.isNaN; },
}
export type c4Return = ReturnType<ReturnType<typeof c4>>;
export type c4oReturn = ReturnType<ReturnType<typeof cObj['c4']>>;
export function d1() {
const fn = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN;
return function() { return fn };
}
export function d2() {
const fn = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN;
return function() { return fn };
}
export function d3() {
const fn = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar;
return function() { return fn };
}
export function d4() {
const fn = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN;
return function() { return fn };
}
export type d4Return = ReturnType<ReturnType<ReturnType<ReturnType<typeof d4>>>>;
export class A {
method1(isNaN: typeof globalThis.isNaN) { return isNaN }
method2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN }
method3(isNaN: number, bar: typeof globalThis.isNaN) { return bar }
method4(isNaN: number) { return globalThis.isNaN; }
}
export function fromParameter(isNaN: number, bar: typeof globalThis.isNaN) {
return function() { return { bar } };
}
// Non-inference cases.
export const explicitlyTypedVariable: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN = (isNaN) => isNaN;
export function explicitlyTypedFunction(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN {
return isNaN;
};
export type AsObjectProperty = {
isNaN: typeof globalThis.isNaN;
}
export class AsClassProperty {
isNaN?: typeof globalThis.isNaN;
}
export type AsFunctionType = (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN;