@@ -192,21 +192,42 @@ export interface Options extends GeneralOptions, TscOptions {
192192 /**
193193 * **[Experimental]** Enables DTS generation using `tsgo`.
194194 *
195- * To use this option, make sure `@typescript/native-preview` is installed as a dependency.
195+ * To use this option, make sure `@typescript/native-preview` is installed as a dependency,
196+ * or provide a custom path to the `tsgo` binary using the `path` option.
196197 *
197198 * **Note:** This option is not yet recommended for production environments.
198199 * `tsconfigRaw` and `isolatedDeclarations` options will be ignored when this option is enabled.
200+ *
201+ *
202+ * ```ts
203+ * // Use tsgo from `@typescript/native-preview` dependency
204+ * tsgo: true
205+ *
206+ * // Use custom tsgo path (e.g., managed by Nix)
207+ * tsgo: { path: '/path/to/tsgo' }
208+ * ```
199209 */
200- tsgo ?: boolean
210+ tsgo ?: boolean | TsgoOptions
211+ }
212+
213+ export interface TsgoOptions {
214+ enabled ?: boolean
215+
216+ /**
217+ * Custom path to the `tsgo` binary.
218+ */
219+ path ?: string
201220}
202221
203222type Overwrite < T , U > = Pick < T , Exclude < keyof T , keyof U > > & U
223+
204224export type OptionsResolved = Overwrite <
205225 Required < Omit < Options , 'compilerOptions' > > ,
206226 {
207227 tsconfig ?: string
208228 oxc : IsolatedDeclarationsOptions | false
209229 tsconfigRaw : TsConfigJson
230+ tsgo : Omit < TsgoOptions , 'enabled' > | false
210231 }
211232>
212233
@@ -237,6 +258,13 @@ export function resolveOptions({
237258 oxc,
238259 tsgo = false ,
239260} : Options ) : OptionsResolved {
261+ // Resolve tsgo option
262+ if ( tsgo === true ) {
263+ tsgo = { }
264+ } else if ( typeof tsgo === 'object' && tsgo . enabled === false ) {
265+ tsgo = false
266+ }
267+
240268 let resolvedTsconfig : TsConfigJsonResolved | undefined
241269 if ( tsconfig === true || tsconfig == null ) {
242270 const { config, path } = getTsconfig ( cwd ) || { }
0 commit comments