1# Configuring arkOptions in build-profile.json5 2 3## Configuration File Tag 4 5 **Table 1** types field in the arkOptions tag 6 7| Name| Description| Data Type| Left Unspecified Allowed| 8| -------- | -------- | -------- | -------- | 9| types | Type declaration files to import globally. Using this field can avoid individual imports in each source file.| Array| Yes (initial value: left empty)| 10 11## types Field Configuration in arkOptions 12 13Example of the Types Field in arkOptions 14 15Add the **types** field to the **arkOptions** attribute of the **buildOption** tag in the **build-profile.json5** configuration file of a module. 16```json 17// In /entry/build-profile.json5 18{ 19 "arkOptions": { 20 "types": ["chai", "./oh_modules/@types/mocha", "./src/main/ets/pages/global"] 21 } 22} 23``` 24 25The **types** field can be set to a bundle name, relative path to the bundle location, or relative path to the declaration file. Only the search in the current module is supported. If files with the same name (with different file name extensions) exists in the specified directory, the files are loaded in the following order, from high to low: **.d.ets** > **.d.ts**.<br> 26 (1) Inputting package name: If a bundle name is specified, it is used to search for the declaration files in **oh_modules/@types/**, xxx.<br> 27 (2) Inputting relative path of the package: Search the defined declaration file at the relative path of **build-profile.json5**, for example, **./oh_modules/@types/mocha**.<br> 28 (3) Inputting relative path of the declaration file: Search the declaration file in the relative path, for example, **./src/main/ets/pages/global**. 29 30*Note:* 31 32If you input the package name or the relative path of the package location in the **types** field, **dependencies** at **project file/entry/oh-package.json5** should be set as follows: 33```json 34"dependencies": { 35 "@types/chai": "latest", 36 "@types/mocha": "latest" 37} 38``` 39 40If you input the relative path of the declaration file in the **types** field, make sure the corresponding declaration file, such as the **src/main/ets/pages/global.d.ts** file, exists in the module. The content of the declaration file is as follows: 41```typescript 42declare namespace Global { 43 type ObjectType = string | number; 44} 45``` 46 47After **types** is set to globally import type declarations, the types declared can be used as follows: 48```typescript 49// In entry/src/main/ets/pages/Index.ets 50let a: Chai.Message; 51let b: Mocha.HookFunction; 52let c: Global.ObjectType; 53``` 54