-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
load-lib.ts
27 lines (24 loc) · 892 Bytes
/
load-lib.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* @file Utilities - loadLib
* @module tsconfig-utils/utils/loadLib
*/
import type { LoadTsconfigOptions } from '#src/interfaces'
import type mlly from '@flex-development/mlly'
import type { Lib } from '@flex-development/tsconfig-types'
import { get } from '@flex-development/tutils'
import loadCompilerOptions from './load-compiler-options'
/**
* Loads [type definition library names][1] from a [tsconfig][2] file.
*
* [1]: https://www.typescriptlang.org/tsconfig#lib
* [2]: https://www.typescriptlang.org/tsconfig
*
* @param {mlly.ModuleId} tsconfig - Module id of tsconfig file
* @param {LoadTsconfigOptions?} [options] - Tsconfig loading options
* @return {Lib[]} Type definition library names array
*/
const loadLib = (
tsconfig: mlly.ModuleId,
options?: LoadTsconfigOptions
): Lib[] => get(loadCompilerOptions(tsconfig, options), 'lib', [])
export default loadLib