Skip to content

Commit

Permalink
More semantic use of partial<> utility type
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Aug 23, 2023
1 parent 33bfc05 commit e0af9a4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions copy-folder.ts
@@ -1,15 +1,16 @@
// copy-folder-util ~~ MIT License

// Imports
import fs from 'fs';
import path from 'path';
import slash from 'slash';

// Types
export type Settings = {
basename: string, //filter files by filename ignoring the file extension
cd: string, //change working directory before starting copy
fileExtensions: string[], //filter files by file extensions, example: ['.js', '.css']
};
export type Options = Partial<Settings>;
export type Results = {
source: string, //path of origination folder
target: string, //path of destination folder
Expand All @@ -23,7 +24,7 @@ const extraneousFolders = ['.git', 'node_modules'];

const copyFolder = {

cp(sourceFolder: string, targetFolder: string, options?: Options): Results {
cp(sourceFolder: string, targetFolder: string, options?: Partial<Settings>): Results {
const defaults = {
basename: null,
cd: null,
Expand Down

0 comments on commit e0af9a4

Please sign in to comment.