Repository: oclif/core
Pull request #43 (2020-09-16 18:39:25)

fix: export TSConfig in Interfaces

codecov[bot]: # [Codecov](https://codecov.io/gh/oclif/core/pull/43?src=pr&el=h1) Report
> Merging [#43](https://codecov.io/gh/oclif/core/pull/43?src=pr&el=desc) into [master](https://codecov.io/gh/oclif/core/commit/10d3de9144998bbf015812d4a08d3bf2509b7fc7?el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/oclif/core/pull/43/graphs/tree.svg?width=650&height=150&src=pr&token=K0kGk9tefA)](https://codecov.io/gh/oclif/core/pull/43?src=pr&el=tree)

```diff
@@          Coverage Diff           @@
##           master     #43   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           3       3           
  Lines          15      15           
  Branches        2       2           
======================================
  Misses         15      15           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/oclif/core/pull/43?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/oclif/core/pull/43?src=pr&el=footer). Last update [10d3de9...b19b46d](https://codecov.io/gh/oclif/core/pull/43?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/src/config/ts-node.ts b/src/config/ts-node.ts
index 8bd84ee..c3fb2c7 100644
--- a/src/config/ts-node.ts
+++ b/src/config/ts-node.ts
@@ -2,6 +2,7 @@ import * as fs from 'fs'
 import * as path from 'path'
 import * as TSNode from 'ts-node'
 
+import {TSConfig} from '../interfaces/ts-config'
 import {Debug} from './util'
 // eslint-disable-next-line new-cap
 const debug = Debug()
@@ -10,18 +11,6 @@ const tsconfigs: {[root: string]: TSConfig} = {}
 const rootDirs: string[] = []
 const typeRoots = [`${__dirname}/../node_modules/@types`]
 
-export interface TSConfig {
-  compilerOptions: {
-    rootDir?: string;
-    rootDirs?: string[];
-    outDir?: string;
-    target?: string;
-    esModuleInterop?: boolean;
-    experimentalDecorators?: boolean;
-    emitDecoratorMetadata?: boolean;
-  };
-}
-
 function loadTSConfig(root: string): TSConfig | undefined {
   const tsconfigPath = path.join(root, 'tsconfig.json')
   let typescript: typeof import('typescript') | undefined
diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts
index 1aebac2..1d1ce08 100644
--- a/src/interfaces/index.ts
+++ b/src/interfaces/index.ts
@@ -5,3 +5,4 @@ export {Manifest} from './manifest'
 export {PJSON} from './pjson'
 export {Plugin, PluginOptions, Options} from './plugin'
 export {Topic} from './topic'
+export {TSConfig} from './ts-config'
diff --git a/src/interfaces/ts-config.ts b/src/interfaces/ts-config.ts
new file mode 100644
index 0000000..b656541
--- /dev/null
+++ b/src/interfaces/ts-config.ts
@@ -0,0 +1,11 @@
+export interface TSConfig {
+  compilerOptions: {
+    rootDir?: string;
+    rootDirs?: string[];
+    outDir?: string;
+    target?: string;
+    esModuleInterop?: boolean;
+    experimentalDecorators?: boolean;
+    emitDecoratorMetadata?: boolean;
+  };
+}


Test patch:
diff --git a/test/config/ts-node.test.ts b/test/config/ts-node.test.ts
index 6d5ea81..157fadd 100644
--- a/test/config/ts-node.test.ts
+++ b/test/config/ts-node.test.ts
@@ -2,7 +2,7 @@ import * as path from 'path'
 import * as proxyquire from 'proxyquire'
 import * as tsNode from 'ts-node'
 
-import {TSConfig} from '../../src/config/ts-node'
+import {Interfaces} from '../../src'
 
 import {expect, fancy} from './test'
 
@@ -10,18 +10,18 @@ const root = path.resolve(__dirname, 'fixtures/typescript')
 const orig = 'src/hooks/init.ts'
 let tsNodeRegisterCallArguments: any[] = []
 
-const DEFAULT_TS_CONFIG: TSConfig = {
+const DEFAULT_TS_CONFIG: Interfaces.TSConfig = {
   compilerOptions: {},
 }
 
-const withMockTsConfig = (config: TSConfig = DEFAULT_TS_CONFIG) => {
+const withMockTsConfig = (config: Interfaces.TSConfig = DEFAULT_TS_CONFIG) => {
   const tsNodePlugin = proxyquire('../../src/config/ts-node', {fs: {
     existsSync: () => true,
     readFileSync: () => JSON.stringify(config),
   }})
 
-  // This prints "loadTSConfig unstubbed" not "loadTSConfig proxyquire"!
-  tsNodePlugin.tsPath('poop', 'asdf')
+  // This prints "loadInterfaces.TSConfig unstubbed" not "loadInterfaces.TSConfig proxyquire"!
+  tsNodePlugin.tsPath('qwerty', 'asdf')
 
   return fancy
   .add('tsNodePlugin', () => tsNodePlugin)