Skip to content
This repository was archived by the owner on Oct 25, 2023. It is now read-only.

Commit a7e37fe

Browse files
committed
feat: widen input type to accept into calculation
1 parent 3918fc4 commit a7e37fe

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ mod error;
6464
use crate::error::Error;
6565

6666
/// Method to use to enumerate inputs to the TypeScript compiler.
67-
#[derive(Debug)]
67+
#[derive(Copy, Clone, Debug)]
6868
pub enum Calculation {
6969
/// Estimate the true list of inputs to the TypeScript compiler by listing
7070
/// the files matching the tsconfig's `include` globs.
@@ -278,14 +278,15 @@ fn tsconfig_includes_estimate(
278278
///
279279
/// - `monorepo_root` may be an absolute path
280280
/// - `tsconfig_files` should be relative paths from the monorepo root
281-
pub fn tsconfig_includes_by_package_name<P, Q>(
281+
pub fn tsconfig_includes_by_package_name<P, Q, C>(
282282
monorepo_root: P,
283283
tsconfig_files: &[Q],
284-
calculation_type: Calculation,
284+
calculation_type: C,
285285
) -> Result<HashMap<String, Vec<PathBuf>>, Error>
286286
where
287287
P: AsRef<Path> + Sync,
288288
Q: AsRef<Path>,
289+
C: Into<Calculation> + Copy + Sync + Send,
289290
{
290291
let lerna_manifest =
291292
monorepo_manifest::MonorepoManifest::from_directory(monorepo_root.as_ref())?;
@@ -352,7 +353,7 @@ where
352353
.map(|package| -> Result<(_, _), Error> {
353354
// This relies on the assumption that tsconfig.json is always the name of the tsconfig file
354355
let tsconfig = &monorepo_root.as_ref().join(package.tsconfig_file);
355-
let mut included_files = match calculation_type {
356+
let mut included_files = match calculation_type.into() {
356357
Calculation::Estimate => {
357358
tsconfig_includes_estimate(monorepo_root.as_ref(), tsconfig)
358359
}

0 commit comments

Comments
 (0)