Skip to content

Commit

Permalink
fix(compiler): match tsconfig include paths properly
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduy1407 committed Dec 5, 2023
1 parent 7c94eea commit b51cec4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/compiler/sys/typescript/typescript-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,21 @@ const createDefaultTsConfig = (config: d.Config) =>
2,
);

const hasSrcDirectoryInclude = (includeProp: string[], src: string) =>
Array.isArray(includeProp) && includeProp.includes(src);
/**
* Determines if the included `src` argument belongs in `includeProp`.
*
* This function normalizes the paths found in both arguments, to catch cases where it's called with:
* ```ts
* hasSrcDirectoryInclude(['src'], './src'); // should return `true`
* ```
*
* @param includeProp the paths in `include` that should be tested
* @param src the path to find in `includeProp`
* @returns true if the provided `src` directory is found, `false` otherwise
*/
export const hasSrcDirectoryInclude = (includeProp: string[], src: string): boolean =>
Array.isArray(includeProp) &&
includeProp.some((included) => normalizePath(included, false) === normalizePath(src, false));

const hasRindoConfigInclude = (includeProp: string[]) =>
Array.isArray(includeProp) && includeProp.includes('rindo.config.ts');

0 comments on commit b51cec4

Please sign in to comment.