Skip to content

Commit d264a2a

Browse files
committed
refactor: add more type annotations to utils/security.ts
1 parent 4bb074b commit d264a2a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/core/utils/security.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ function stringSha256Sync(contents: string) {
5757
return sha256.digest('hex');
5858
}
5959

60-
function sortJsonToArr(json) {
61-
const rs = [];
60+
function sortJsonToArr(json: Record<string, string>) {
61+
const rs: { path: string; hash: string }[] = [];
6262
_.forIn(json, (value, key) => {
6363
rs.push({ path: key, hash: value });
6464
});
@@ -67,7 +67,7 @@ function sortJsonToArr(json) {
6767

6868
// some files are ignored in calc hash in client sdk
6969
// https://github.com/Microsoft/react-native-code-push/pull/974/files#diff-21b650f88429c071b217d46243875987R15
70-
function isHashIgnored(relativePath) {
70+
function isHashIgnored(relativePath: string) {
7171
if (!relativePath) {
7272
return true;
7373
}
@@ -97,7 +97,7 @@ function isPackageHashIgnored(relativePath: string) {
9797
);
9898
}
9999

100-
export function packageHashSync(jsonData) {
100+
export function packageHashSync(jsonData: Record<string, string>) {
101101
const sortedArr = sortJsonToArr(jsonData);
102102
const manifestData = _.filter(sortedArr, (v) => {
103103
return !isPackageHashIgnored(v.path);
@@ -130,7 +130,7 @@ function sha256AllFiles(files: string[]): Promise<Record<string, string>> {
130130
}
131131

132132
export function uploadPackageType(directoryPath: string) {
133-
return new Promise((resolve, reject) => {
133+
return new Promise<number>((resolve, reject) => {
134134
recursive(directoryPath, (err, files) => {
135135
if (err) {
136136
logger.error(new AppError(err.message));

0 commit comments

Comments
 (0)