jiek 2.2.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/utils/ts.ts CHANGED
@@ -4,7 +4,7 @@ import { dirname, resolve } from 'node:path'
4
4
  import { parse } from 'jsonc-parser'
5
5
  import { isMatch } from 'micromatch'
6
6
 
7
- type TSConfig = {
7
+ interface TSConfig {
8
8
  extends?: string | string[]
9
9
  compilerOptions?: Record<string, unknown>
10
10
  references?: { path: string }[]
@@ -16,7 +16,7 @@ type TSConfig = {
16
16
  const getTSConfig = (p: string): TSConfig =>
17
17
  !fs.existsSync(p) || !fs.statSync(p).isFile()
18
18
  ? {}
19
- : parse(fs.readFileSync(p, 'utf-8'), [], { allowTrailingComma: true, allowEmptyContent: true })
19
+ : parse(fs.readFileSync(p, 'utf-8'), [], { allowTrailingComma: true, allowEmptyContent: true }) as TSConfig
20
20
 
21
21
  const getExtendTSConfig = (tsconfigPath: string): TSConfig => {
22
22
  tsconfigPath = resolve(tsconfigPath)
@@ -25,7 +25,7 @@ const getExtendTSConfig = (tsconfigPath: string): TSConfig => {
25
25
  const resolvePaths = (paths: string[] | undefined) => paths?.map(p => resolve(tsconfigPathDirname, p)) ?? []
26
26
 
27
27
  const extendsPaths = resolvePaths(
28
- exts ? Array.isArray(exts) ? exts : [exts] : []
28
+ exts !== undefined ? Array.isArray(exts) ? exts : [exts] : []
29
29
  )
30
30
  if (extendsPaths.length === 0) return tsconfig
31
31
  return extendsPaths