• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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
16class A {}
17
18class G {}
19
20class B {
21  static a: A
22}
23
24class C {
25  static g: G
26}
27
28const c = new C();
29
30class D {
31  static a: A | undefined = undefined
32  static g: G;
33}
34
35class F {
36  static a: A
37  static g: G | undefined = undefined;
38}
39
40const f = new F();
41
42@Entry
43@Component
44struct Index {
45  @State message: string = 'Hello World';
46  public static abc:string ;
47
48  build() {
49      Text(this.message)
50      .height('100%')
51      .width('100%')
52  }
53}
54
55// Top 0 case
56class BB {}
57
58class AA {
59  static b: BB;
60}
61
62class CC {
63  static count: number;
64}
65
66class DD {
67  static config: { theme: string};
68}
69
70class EE {
71  static name: string;
72  constructor() {
73    E.name = "default"
74  }
75}
76
77// Basic Types
78class PrimitiveTypes {
79  static uninitializedString: string;
80  static uninitializedNumber: number;
81  static uninitializedBoolean: boolean;
82}
83
84// Array Types
85class ArrayTypes {
86  static uninitializedStringArray: string[];
87  static uninitializedNumberArray: number[];
88  static uninitializedObjectArray: { id: number }[];
89  static uninitializedUnionArray: (string | number)[];
90}
91
92// Object Types
93class ObjectTypes {
94  static uninitializedSimpleObject: { name: string; age: number };
95  static uninitializedNestedObject: {
96    id: number;
97    metadata: {
98      createdAt: Date;
99      tags: string[];
100    };
101  };
102}
103
104// Special Built-in Types
105class BuiltInTypes {
106  static uninitializedDate: Date;
107  static uninitializedMap: Map<string, number>;
108  static uninitializedSet: Set<string>;
109  static uninitializedPromise: Promise<void>;
110}
111
112// Union and Intersection Types
113class AdvancedTypes {
114  static uninitializedUnion: string | number;
115  static uninitializedIntersection: { name: string } & { age: number };
116  static uninitializedLiteralUnion: 'success' | 'error';
117}
118
119// Optional and Nullable Types
120class NullableTypes {
121  static uninitializedOptional?: string;
122  static uninitializedNull: null;
123  static uninitializedUndefined: undefined;
124}
125
126// Generic Types
127class GenericTypes<T> {
128  static uninitializedGenericArray: T[];
129  static uninitializedGenericValue: T;
130}
131
132// Function Types
133class FunctionTypes {
134  static uninitializedFunction: () => void;
135  static uninitializedCallback: (result: string) => number;
136}
137
138// Complex Combined Types
139class ComplexTypes {
140  static uninitializedComplexArray: Array<{ id: number; data: Map<string, Set<number>> }>;
141  static uninitializedRecord: Record<string, { value: number }>;
142  static uninitializedTuple: [string, number, boolean?];
143}
144
145// Custom Class Types
146class User {
147  id: number;
148  name: string;
149}
150
151class CustomClassTypes {
152  static uninitializedUser: User;
153  static uninitializedUsers: User[];
154}
155
156// Enum Types
157enum Status {
158  Active,
159  Inactive
160}
161
162class EnumTypes {
163  static uninitializedStatus: Status;
164  static uninitializedStatusArray: Status[];
165}
166
167// Never and Unknown Types
168class SpecialTypes {
169  static uninitializedNever: never;
170  static uninitializedUnknown: unknown;
171  static uninitializedAny: any;
172}
173
174
175class Test1 {
176  static count: string | undefined;
177}
178