1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16function FunctionCtor() {}
17let c = new FunctionCtor();
18
19interface I {}
20
21type IConstructor = new (x: number, y: number) => I;
22
23function createI(
24  ctor: IConstructor
25): I {
26  return new ctor(1, 2);
27}
28
29function createI2(
30  ctor: new (x: number, y: number) => I
31): I {
32  return new ctor(1, 2);
33}
34
35interface IConstructor3 {
36  new (s: string): I;
37}
38function createI3(ctor: IConstructor3) {
39  return new ctor("hello");
40}
41
42class C {}
43
44type Constructor = {
45  new (s: string): C;
46};
47
48function createC(ctor: Constructor) {
49  return new ctor("hello");
50}
51