* Create returnOnlySignature only when inferences will possibly be made * Add regression test * Accept new baselines
59 lines
783 B
TypeScript
59 lines
783 B
TypeScript
// @strict: true
|
|
|
|
// Repro from #34849
|
|
|
|
interface IData {
|
|
bar: boolean
|
|
}
|
|
|
|
declare function test<TDependencies>(
|
|
getter: (deps: TDependencies, data: IData) => any,
|
|
deps: TDependencies,
|
|
): any
|
|
|
|
const DEPS = {
|
|
foo: 1
|
|
}
|
|
|
|
test(
|
|
(deps, data) => ({
|
|
fn1: function() { return deps.foo },
|
|
fn2: data.bar
|
|
}),
|
|
DEPS
|
|
);
|
|
|
|
test(
|
|
(deps: typeof DEPS, data) => ({
|
|
fn1: function() { return deps.foo },
|
|
fn2: data.bar
|
|
}),
|
|
DEPS
|
|
);
|
|
|
|
test(
|
|
(deps, data) => ({
|
|
fn1: () => deps.foo,
|
|
fn2: data.bar
|
|
}),
|
|
DEPS
|
|
);
|
|
|
|
test(
|
|
(deps, data) => {
|
|
return {
|
|
fn1() { return deps.foo },
|
|
fn2: data.bar
|
|
}
|
|
},
|
|
DEPS
|
|
);
|
|
|
|
test(
|
|
(deps) => ({
|
|
fn1() { return deps.foo },
|
|
fn2: 1
|
|
}),
|
|
DEPS
|
|
);
|