From 85d80781abb51416baf6289152e92fbac680e34f Mon Sep 17 00:00:00 2001 From: igorlegalov Date: Wed, 16 Jul 2025 18:11:24 +0300 Subject: [PATCH] Remove NullishType alias Issue: https://gitee.com/open_harmony/dashboard?issue_id=ICW8Y8 Testing: all pre-merge tests passed Signed-off-by: igorlegalov --- .../ani/ets/@ohos.file.environment.ets | 8 +- .../js/src/mod_fs/ani/ets/@ohos.file.fs.ets | 188 +++++++++--------- .../src/mod_hash/ani/ets/@ohos.file.hash.ets | 4 +- .../ani/ets/@ohos.file.securityLabel.ets | 8 +- .../ani/ets/@ohos.file.statvfs.ets | 8 +- 5 files changed, 108 insertions(+), 108 deletions(-) diff --git a/interfaces/kits/js/src/mod_environment/ani/ets/@ohos.file.environment.ets b/interfaces/kits/js/src/mod_environment/ani/ets/@ohos.file.environment.ets index 71b8e1c2d..8edfc5055 100644 --- a/interfaces/kits/js/src/mod_environment/ani/ets/@ohos.file.environment.ets +++ b/interfaces/kits/js/src/mod_environment/ani/ets/@ohos.file.environment.ets @@ -19,7 +19,7 @@ namespace Environment { export function getStorageDataDir(): Promise { return new Promise((resolve: (result: string) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute(EnvironmentImpl.getStorageDataDirSync); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as string; resolve(result); }).catch((e: Error): void => { @@ -30,7 +30,7 @@ namespace Environment { export function getStorageDataDir(callback: AsyncCallback): void { let promise = taskpool.execute(EnvironmentImpl.getStorageDataDirSync); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as string; @@ -43,7 +43,7 @@ namespace Environment { export function getUserDataDir(): Promise { return new Promise((resolve: (result: string) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute(EnvironmentImpl.getUserDataDirSync); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as string; resolve(result); }).catch((e: Error): void => { @@ -53,7 +53,7 @@ namespace Environment { } export function getUserDataDir(callback: AsyncCallback): void { let promise = taskpool.execute(EnvironmentImpl.getUserDataDirSync); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as string; diff --git a/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets b/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets index 4b01ef430..c991a6cdf 100644 --- a/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets +++ b/interfaces/kits/js/src/mod_fs/ani/ets/@ohos.file.fs.ets @@ -60,7 +60,7 @@ function access(path: string, mode?: AccessModeType): Promise { let promise = taskpool.execute((path: string, mode?: AccessModeType): boolean => { return FileIoImpl.doAccessSync(path, mode); }, path, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as boolean; resolve(result); }).catch((e: Error): void => { @@ -73,7 +73,7 @@ function access(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string): boolean => { return FileIoImpl.doAccessSync(path); }, path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as boolean; @@ -88,7 +88,7 @@ function access(path: string, mode: AccessModeType, flag: AccessFlagType): Promi let promise = taskpool.execute((path: string, mode: AccessModeType, flag: AccessFlagType): boolean => { return FileIoImpl.doAccessSync(path, mode, flag); }, path, mode, flag); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as boolean; resolve(result); }).catch((e: Error): void => { @@ -108,7 +108,7 @@ function accessSync(path: string, mode: AccessModeType, flag: AccessFlagType): b function close(file: int | File): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((file: int | File) => FileIoImpl.closeSync(file), file); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -118,7 +118,7 @@ function close(file: int | File): Promise { function close(file: int | File, callback: AsyncCallback): void { let promise = taskpool.execute((file: int | File) => FileIoImpl.closeSync(file), file); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -163,7 +163,7 @@ function getxattr(path: string, key: string): Promise { let promise = taskpool.execute((path: string, key: string): string => { return FileIoImpl.getxattrSync(path, key); }, path, key); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as string; resolve(result); }).catch((e: Error): void => { @@ -185,7 +185,7 @@ function copyDir(src: string, dest: string, mode?: int): Promise { reject: (e: BusinessError>) => void): void => { let promise = taskpool.execute((src: string, dest: string, mode?: int) => FileIoImpl.copyDirSync(src, dest, mode), src, dest, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError>); @@ -196,7 +196,7 @@ function copyDir(src: string, dest: string, mode?: int): Promise { function copyDir(src: string, dest: string, callback: AsyncCallback>): void { let promise = taskpool.execute((src: string, dest: string) => FileIoImpl.copyDirSync(src, dest), src, dest); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError>(); e.code = 0; e.data = new Array(0); @@ -209,7 +209,7 @@ function copyDir(src: string, dest: string, callback: AsyncCallback>): void { let promise = taskpool.execute((src: string, dest: string, mode: int) => FileIoImpl.copyDirSync(src, dest, mode), src, dest, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError>(); e.code = 0; e.data = new Array(0); @@ -219,7 +219,7 @@ function copyDir(src: string, dest: string, mode: int, callback: AsyncCallback { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((fd: int) => FileIoImpl.fdatasyncSync(fd), fd); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -261,7 +261,7 @@ function fdatasync(fd: int): Promise { function fdatasync(fd: int, callback: AsyncCallback): void { let promise = taskpool.execute((fd: int) => FileIoImpl.fdatasyncSync(fd), fd); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -287,7 +287,7 @@ function mkdirSync2(path: string, recursion: boolean): undefined { function mkdir(path: string): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string): undefined => mkdirSync1(path), path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -297,7 +297,7 @@ function mkdir(path: string): Promise { function mkdir(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string): undefined => mkdirSync1(path), path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -310,9 +310,9 @@ function mkdir(path: string, recursion: boolean): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string, recursion: boolean): undefined => mkdirSync2(path, recursion), path, recursion); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); - }).catch((e: NullishType): void => { + }).catch((e: Any): void => { reject(e as BusinessError); }); }); @@ -321,7 +321,7 @@ function mkdir(path: string, recursion: boolean): Promise { function mkdir(path: string, recursion: boolean, callback: AsyncCallback): void { let promise = taskpool.execute((path: string, recursion: boolean): undefined => mkdirSync2(path, recursion), path, recursion); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -340,7 +340,7 @@ function moveDir(src: string, dest: string, mode?: int): Promise { let promise = taskpool.execute((src: string, dest: string, mode?: int) => { FileIoImpl.movedirSync(src, dest, mode); }, src, dest, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError>); @@ -352,7 +352,7 @@ function moveDir(src: string, dest: string, callback: AsyncCallback { FileIoImpl.movedirSync(src, dest); }, src, dest); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError>(); e.code = 0; e.data = new Array(0); @@ -366,7 +366,7 @@ function moveDir(src: string, dest: string, mode: int, callback: AsyncCallback { FileIoImpl.movedirSync(src, dest, mode); }, src, dest, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError>(); e.code = 0; e.data = new Array(0); @@ -376,7 +376,7 @@ function moveDir(src: string, dest: string, mode: int, callback: AsyncCallback { let promise = taskpool.execute((prefix: string): string => { return FileIoImpl.mkdtempSync(prefix); }, prefix); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as string; resolve(result); }).catch((e: Error): void => { @@ -419,7 +419,7 @@ function mkdtemp(prefix: string, callback: AsyncCallback): void { let promise = taskpool.execute((prefix: string): string => { return FileIoImpl.mkdtempSync(prefix); }, prefix); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as string; @@ -438,7 +438,7 @@ function moveFile(src: string, dest: string, mode?: int): Promise { let promise = taskpool.execute((src: string, dest: string, mode?: int) => { FileIoImpl.moveFileSync(src, dest, mode); }, src, dest, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -450,7 +450,7 @@ function moveFile(src: string, dest: string, mode: int, callback: AsyncCallback< let promise = taskpool.execute((src: string, dest: string, mode: int) => { FileIoImpl.moveFileSync(src, dest, mode); }, src, dest, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -463,7 +463,7 @@ function moveFile(src: string, dest: string, callback: AsyncCallback): voi let promise = taskpool.execute((src: string, dest: string) => { FileIoImpl.moveFileSync(src, dest); }, src, dest); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -481,7 +481,7 @@ function open(path: String, mode?: int): Promise { let promise = taskpool.execute((path: String, mode?: int): File => { return FileIoImpl.openSync(path, mode); },path, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let file = ret as File; resolve(file); }).catch((e: Error): void => { @@ -494,7 +494,7 @@ function open(path: String, mode: int, callback: AsyncCallback): voi let promise = taskpool.execute((path: String, mode: int): File => { return FileIoImpl.openSync(path, mode); }, path, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let file = ret as File; @@ -509,7 +509,7 @@ function open(path: String, callback: AsyncCallback): void { let promise = taskpool.execute((path: String): File => { return FileIoImpl.openSync(path); }, path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let file = ret as File; @@ -529,7 +529,7 @@ function write(fd: int, buffer: string | ArrayBuffer, options?: WriteOptions): P let promise = taskpool.execute((fd: int, buffer: string | ArrayBuffer, options?: WriteOptions): long => { return FileIoImpl.writeSync(fd, buffer, options); }, fd, buffer, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as long resolve(result); }).catch((e: Error): void => { @@ -543,7 +543,7 @@ function write(fd: int, buffer: string | ArrayBuffer, options: WriteOptions, let promise = taskpool.execute((fd: int, buffer: string | ArrayBuffer, options: WriteOptions): long => { return FileIoImpl.writeSync(fd, buffer, options); }, fd, buffer, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -557,7 +557,7 @@ function write(fd: int, buffer: string | ArrayBuffer, callback: AsyncCallback { return FileIoImpl.writeSync(fd, buffer); }, fd, buffer); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -576,7 +576,7 @@ function read(fd: int, buffer: ArrayBuffer, options?: ReadOptions): Promise { return FileIoImpl.readSync(fd, buffer, options) }, fd, buffer, options); - promise.then((ret: NullishType) => { + promise.then((ret: Any) => { let result = ret as long; resolve(result); }).catch((e: Error): void => { @@ -589,7 +589,7 @@ function read(fd: int, buffer: ArrayBuffer, callback: AsyncCallback) let promise = taskpool.execute((fd: int, buffer: ArrayBuffer): long => { return FileIoImpl.readSync(fd, buffer); }, fd, buffer); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -603,7 +603,7 @@ function read(fd: int, buffer: ArrayBuffer, options: ReadOptions, callback: Asyn let promise = taskpool.execute((fd: int, buffer: ArrayBuffer, options: ReadOptions): long => { return FileIoImpl.readSync(fd, buffer, options); }, fd, buffer, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -623,7 +623,7 @@ function readLines(filePath: string, options?: Options): Promise let promise = taskpool.execute((filePath: string, options?: Options): ReaderIterator => { return FileIoImpl.readlinesSync(filePath, options); }, filePath, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let it = ret as ReaderIterator; resolve(it); }).catch((e: Error): void => { @@ -636,7 +636,7 @@ function readLines(filePath: string, callback: AsyncCallback): v let promise = taskpool.execute((filePath: string): ReaderIterator => { return FileIoImpl.readlinesSync(filePath); }, filePath); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let it = ret as ReaderIterator; @@ -651,7 +651,7 @@ function readLines(filePath: string, options: Options, callback: AsyncCallback { return FileIoImpl.readlinesSync(filePath, options); }, filePath, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let it = ret as ReaderIterator; @@ -670,7 +670,7 @@ function rmdir(path: string): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string): void => FileIoImpl.rmdirSync(path), path); - promise.then((ret: NullishType) => { + promise.then((ret: Any) => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -680,7 +680,7 @@ function rmdir(path: string): Promise { function rmdir(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string): void => FileIoImpl.rmdirSync(path), path); - promise.then((ret: NullishType) => { + promise.then((ret: Any) => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -698,7 +698,7 @@ function truncate(file: string | int, len?: long): Promise { let promise = taskpool.execute((file: string | int, len?: long) => { FileIoImpl.truncateSync(file, len); }, file, len); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -710,7 +710,7 @@ function truncate(file: string | int, callback: AsyncCallback): void { let promise = taskpool.execute((file: string | int) => { FileIoImpl.truncateSync(file); }, file); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -723,7 +723,7 @@ function truncate(file: string | int, len: long, callback: AsyncCallback): let promise = taskpool.execute((file: string | int, len: long) => { FileIoImpl.truncateSync(file, len); }, file, len); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -740,7 +740,7 @@ function unlink(path: string): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string) => unlinkSync(path), path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -750,7 +750,7 @@ function unlink(path: string): Promise { function unlink(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string) => unlinkSync(path), path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -764,7 +764,7 @@ function readText(filePath: string, options?: ReadTextOptions): Promise let promise = taskpool.execute((filePath: string, options?: ReadTextOptions): string => { return FileIoImpl.readTextSync(filePath, options); }, filePath, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let r = ret as string; resolve(r); }).catch((e: Error): void => { @@ -777,7 +777,7 @@ function readText(filePath: string, callback: AsyncCallback): void { let promise = taskpool.execute((filePath: string): string => { return FileIoImpl.readTextSync(filePath); }, filePath); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let r = ret as string; @@ -791,7 +791,7 @@ function readText(filePath: string, options: ReadTextOptions, callback: AsyncCal let promise = taskpool.execute((filePath: string, options: ReadTextOptions): string => { return FileIoImpl.readTextSync(filePath, options); }, filePath, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let r = ret as string; @@ -810,7 +810,7 @@ function listFile(path: string, options?: ListFileOptions): Promise { let promise = taskpool.execute((path: string, options?: ListFileOptions): string[] => { return FileIoImpl.listFileSync(path, options); }, path, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let r = ret as string[]; resolve(r); }).catch((e: Error): void => { @@ -823,7 +823,7 @@ function listFile(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string): string[] => { return FileIoImpl.listFileSync(path); }, path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let r = ret as string[]; @@ -837,7 +837,7 @@ function listFile(path: string, options: ListFileOptions, callback: AsyncCallbac let promise = taskpool.execute((path: string, options: ListFileOptions): string[] => { return FileIoImpl.listFileSync(path, options); }, path, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let r = ret as string[]; @@ -864,7 +864,7 @@ function stat(file: string | int): Promise { let promise = taskpool.execute((file: string | int): Stat => { return FileIoImpl.statSync(file); }, file); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let r = ret as Stat; resolve(r); }).catch((e: Error): void => { @@ -877,7 +877,7 @@ function stat(file: string | int, callback: AsyncCallback): void { let p = taskpool.execute((file: string | int): Stat => { return FileIoImpl.statSync(file); }, file); - p.then((ret: NullishType): void => { + p.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let r = ret as Stat; @@ -896,7 +896,7 @@ function fsync(fd: int): Promise { let promise = taskpool.execute((fd: int) => { FileIoImpl.fsyncSync(fd); }, fd); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -908,7 +908,7 @@ function fsync(fd: int, callback: AsyncCallback): void { let promise = taskpool.execute((fd: int) => { FileIoImpl.fsyncSync(fd); }, fd); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -927,7 +927,7 @@ function symlink(target: string, srcPath: string): Promise { let promise = taskpool.execute((target: string, srcPath: string) => { FileIoImpl.symlinkSync(target, srcPath); }, target, srcPath); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -943,7 +943,7 @@ function rename(oldPath: string, newPath: string): Promise { let promise = taskpool.execute((oldPath: string, newPath: string) => { FileIoImpl.renameSync(oldPath, newPath); }, oldPath, newPath); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -955,7 +955,7 @@ function rename(oldPath: string, newPath: string, callback: AsyncCallback) let promise = taskpool.execute((oldPath: string, newPath: string) => { FileIoImpl.renameSync(oldPath, newPath); }, oldPath, newPath); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -977,7 +977,7 @@ function createRandomAccessFile(file: string | File, mode?: int, options?: RandomAccessFileOptions): RandomAccessFile => { return FileIoImpl.createRandomAccessFileSync(file, mode, options); }, file, mode, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let raffile = ret as RandomAccessFileInner; resolve(raffile); }).catch((e: Error): void => { @@ -991,7 +991,7 @@ function fdopenStream(fd: int, mode: string): Promise { let promise = taskpool.execute((fd: int, mode: string): Stream => { return FileIoImpl.fdopenStreamSync(fd, mode); }, fd, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let stream = ret as Stream; resolve(stream); }).catch((e: Error): void => { @@ -1008,7 +1008,7 @@ function setxattr(path: string, key: string, value: string): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string, key: string, value: string) => FileIoImpl.setxattrSync(path, key, value), path, key, value); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -1020,7 +1020,7 @@ function createRandomAccessFile(file: string | File, callback: AsyncCallback { return FileIoImpl.createRandomAccessFileSync(file); }, file); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let raffile = ret as RandomAccessFile; @@ -1036,7 +1036,7 @@ function createRandomAccessFile(file: string | File, mode: int, let promise = taskpool.execute((file: string | File, mode: int): RandomAccessFile => { return FileIoImpl.createRandomAccessFileSync(file, mode); }, file, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let raffile = ret as RandomAccessFile; @@ -1051,7 +1051,7 @@ function fdopenStream(fd: int, mode: string, callback: AsyncCallback): v let promise = taskpool.execute((fd: int, mode: string): Stream => { return FileIoImpl.fdopenStreamSync(fd, mode); }, fd, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let stream = ret as Stream; @@ -1071,7 +1071,7 @@ function createStream(path: string, mode: string): Promise { let promise = taskpool.execute((path: string, mode: string): Stream => { return FileIoImpl.createStreamSync(path, mode); }, path, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let stream = ret as Stream; resolve(stream); }).catch((e: Error): void => { @@ -1084,7 +1084,7 @@ function createStream(path: string, mode: string, callback: AsyncCallback { return FileIoImpl.createStreamSync(path, mode); }, path, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let stream = ret as Stream; @@ -1115,7 +1115,7 @@ function symlink(target: string, srcPath: string, callback: AsyncCallback) let promise = taskpool.execute((target: string, srcPath: string) => { FileIoImpl.symlinkSync(target, srcPath); }, target, srcPath); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -1137,7 +1137,7 @@ function lstat(path: string): Promise { let promise = taskpool.execute((path: string): Stat => { return FileIoImpl.lstatSync(path); }, path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { if (ret === null || ret === undefined) { let e = new BusinessError(); e.code = -1; @@ -1156,7 +1156,7 @@ function lstat(path: string, callback: AsyncCallback): void { let p = taskpool.execute((path: string): Stat => { return FileIoImpl.lstatSync(path); }, path); - p.then((ret: NullishType): void => { + p.then((ret: Any): void => { let e = new BusinessError(); if (ret === null || ret === undefined) { e.code = -1; @@ -1175,7 +1175,7 @@ function copyFile(src: string | int, dest: string | int, mode?: int): Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((src: string | int, dest: string | int, mode?: int) => FileIoImpl.copyFileSync(src, dest, mode), src, dest, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -1187,7 +1187,7 @@ function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((srcUri: string, destUri: string, options?: CopyOptions) => FileIoImpl.copySync(srcUri, destUri, options), srcUri, destUri, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -1198,7 +1198,7 @@ function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise): void { let promise = taskpool.execute((src: string | int, dest: string | int, mode: int) => FileIoImpl.copyFileSync(src, dest, mode), src, dest, mode); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -1210,7 +1210,7 @@ function copyFile(src: string | int, dest: string | int, mode: int, callback: As function copy(srcUri: string, destUri: string, options: CopyOptions, callback: AsyncCallback): void { let promise = taskpool.execute((srcUri: string, destUri: string, options: CopyOptions) => FileIoImpl.copySync(srcUri, destUri, options), srcUri, destUri, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -1222,7 +1222,7 @@ function copy(srcUri: string, destUri: string, options: CopyOptions, callback: A function copyFile(src: string | int, dest: string | int, callback: AsyncCallback): void { let promise = taskpool.execute((src: string | int, dest: string | int) => FileIoImpl.copyFileSync(src, dest), src, dest); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -1234,7 +1234,7 @@ function copyFile(src: string | int, dest: string | int, callback: AsyncCallback function copy(srcUri: string, destUri: string, callback: AsyncCallback): void { let promise = taskpool.execute((srcUri: string, destUri: string) => FileIoImpl.copySync(srcUri, destUri), srcUri, destUri); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -1378,7 +1378,7 @@ export class RandomAccessFileInner implements RandomAccessFile { let promise = taskpool.execute((buffer: ArrayBuffer | string, options?: WriteOptions): long => { return this.writeSync(buffer, options); }, buffer, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as long resolve(result); }).catch((e: Error): void => { @@ -1391,7 +1391,7 @@ export class RandomAccessFileInner implements RandomAccessFile { let promise = taskpool.execute((buffer: ArrayBuffer | string, options: WriteOptions): long => { return this.writeSync(buffer, options); }, buffer, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -1405,7 +1405,7 @@ export class RandomAccessFileInner implements RandomAccessFile { let promise = taskpool.execute((buffer: ArrayBuffer | string): long => { return this.writeSync(buffer); }, buffer); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -1428,7 +1428,7 @@ export class RandomAccessFileInner implements RandomAccessFile { let promise = taskpool.execute((buffer: ArrayBuffer, options?: ReadOptions): long => { return this.readSync(buffer, options); }, buffer, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as long; resolve(result); }).catch((e: Error): void => { @@ -1441,7 +1441,7 @@ export class RandomAccessFileInner implements RandomAccessFile { let promise = taskpool.execute((buffer: ArrayBuffer, options: ReadOptions): long => { return this.readSync(buffer, options); }, buffer, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -1455,7 +1455,7 @@ export class RandomAccessFileInner implements RandomAccessFile { let promise = taskpool.execute((buffer: ArrayBuffer): long => { return this.readSync(buffer); }, buffer); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -1512,7 +1512,7 @@ export class FileInner implements File { let promise = taskpool.execute((exclusive?: boolean) => { this.lockSync(exclusive); }, exclusive); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -1524,7 +1524,7 @@ export class FileInner implements File { let promise = taskpool.execute(() => { this.lockSync(); }); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -1537,7 +1537,7 @@ export class FileInner implements File { let promise = taskpool.execute((exclusive: boolean) => { this.lockSync(exclusive); }, exclusive); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -1694,7 +1694,7 @@ export class StreamInner implements Stream { close(): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute(() => this.closeSync()); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -1704,7 +1704,7 @@ export class StreamInner implements Stream { close(callback: AsyncCallback): void { let promise = taskpool.execute(() => this.closeSync()); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -1718,7 +1718,7 @@ export class StreamInner implements Stream { flush(): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute(() => this.flushSync()); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -1728,7 +1728,7 @@ export class StreamInner implements Stream { flush(callback: AsyncCallback): void { let promise = taskpool.execute(() => this.flushSync()); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -1744,7 +1744,7 @@ export class StreamInner implements Stream { let promise = taskpool.execute((buffer: ArrayBuffer | string, options?: WriteOptions): long => { return this.writeSync(buffer, options); }, buffer, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as long resolve(result); }).catch((e: Error): void => { @@ -1757,7 +1757,7 @@ export class StreamInner implements Stream { let promise = taskpool.execute((buffer: ArrayBuffer | string): long => { return this.writeSync(buffer); }, buffer); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -1771,7 +1771,7 @@ export class StreamInner implements Stream { let promise = taskpool.execute((buffer: ArrayBuffer | string, options: WriteOptions): long => { return this.writeSync(buffer, options); }, buffer, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -1788,7 +1788,7 @@ export class StreamInner implements Stream { let promise = taskpool.execute((buffer: ArrayBuffer, options?: ReadOptions): long => { return this.readSync(buffer, options); }, buffer, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as long resolve(result); }).catch((e: Error): void => { @@ -1801,7 +1801,7 @@ export class StreamInner implements Stream { let promise = taskpool.execute((buffer: ArrayBuffer): long => { return this.readSync(buffer); }, buffer); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -1815,7 +1815,7 @@ export class StreamInner implements Stream { let promise = taskpool.execute((buffer: ArrayBuffer, options: ReadOptions): long => { return this.readSync(buffer, options); }, buffer, options); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; diff --git a/interfaces/kits/js/src/mod_hash/ani/ets/@ohos.file.hash.ets b/interfaces/kits/js/src/mod_hash/ani/ets/@ohos.file.hash.ets index 8dbf484cb..8dc386329 100644 --- a/interfaces/kits/js/src/mod_hash/ani/ets/@ohos.file.hash.ets +++ b/interfaces/kits/js/src/mod_hash/ani/ets/@ohos.file.hash.ets @@ -36,7 +36,7 @@ export default namespace hash { export function hash(path: string, algorithm: string): Promise { return new Promise((resolve: (result: string) => void, reject: (e: BusinessError) => void) => { let promise = taskpool.execute(HashImpl.hashSync, path, algorithm); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let res = ret as string; resolve(res); }).catch((e: Error): void => { @@ -47,7 +47,7 @@ export default namespace hash { export function hash(path: string, algorithm: string, callback: AsyncCallback): void { let promise = taskpool.execute(HashImpl.hashSync, path, algorithm); - promise.then((ret: NullishType) => { + promise.then((ret: Any) => { let e = new BusinessError(); e.code = 0; let res = ret as string; diff --git a/interfaces/kits/js/src/mod_securitylabel/ani/ets/@ohos.file.securityLabel.ets b/interfaces/kits/js/src/mod_securitylabel/ani/ets/@ohos.file.securityLabel.ets index 4f81cef3d..12a950215 100644 --- a/interfaces/kits/js/src/mod_securitylabel/ani/ets/@ohos.file.securityLabel.ets +++ b/interfaces/kits/js/src/mod_securitylabel/ani/ets/@ohos.file.securityLabel.ets @@ -21,7 +21,7 @@ namespace securityLabel { export function setSecurityLabel(path: string, type: DataLevel): Promise { return new Promise((resolve: (result: undefined) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string, type: DataLevel): void => SecurityLabelImpl.setSecurityLabelSync(path, type), path, type); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { resolve(undefined); }).catch((e: Error): void => { reject(e as BusinessError); @@ -31,7 +31,7 @@ namespace securityLabel { export function setSecurityLabel(path: string, type: DataLevel, callback: AsyncCallback): void { let promise = taskpool.execute((path: string, type: DataLevel): void => SecurityLabelImpl.setSecurityLabelSync(path, type), path, type); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; callback(e, undefined); @@ -47,7 +47,7 @@ namespace securityLabel { export function getSecurityLabel(path: string): Promise { return new Promise((resolve: (result: string) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute((path: string): string => SecurityLabelImpl.getSecurityLabelSync(path), path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let r = ret as string; resolve(r); }).catch((e: Error): void => { @@ -58,7 +58,7 @@ namespace securityLabel { export function getSecurityLabel(path: string, callback: AsyncCallback): void { let promise = taskpool.execute((path: string): string => SecurityLabelImpl.getSecurityLabelSync(path), path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let r = ret as string; diff --git a/interfaces/kits/js/src/mod_statvfs/ani/ets/@ohos.file.statvfs.ets b/interfaces/kits/js/src/mod_statvfs/ani/ets/@ohos.file.statvfs.ets index 64d8e7284..938f4cc47 100644 --- a/interfaces/kits/js/src/mod_statvfs/ani/ets/@ohos.file.statvfs.ets +++ b/interfaces/kits/js/src/mod_statvfs/ani/ets/@ohos.file.statvfs.ets @@ -23,7 +23,7 @@ namespace statfs { export function getFreeSize(path: string): Promise { return new Promise((resolve: (result: long) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute(StatvfsImpl.getFreeSizeSync, path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as long resolve(result); }).catch((e: Error): void => { @@ -34,7 +34,7 @@ namespace statfs { export function getFreeSize(path: string, callback: AsyncCallback): void { let promise = taskpool.execute(StatvfsImpl.getFreeSizeSync, path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; @@ -51,7 +51,7 @@ namespace statfs { export function getTotalSize(path: string): Promise { return new Promise((resolve: (result: long) => void, reject: (e: BusinessError) => void): void => { let promise = taskpool.execute(StatvfsImpl.getTotalSizeSync, path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let result = ret as long resolve(result); }).catch((e: Error): void => { @@ -62,7 +62,7 @@ namespace statfs { export function getTotalSize(path: string, callback: AsyncCallback): void { let promise = taskpool.execute(StatvfsImpl.getTotalSizeSync, path); - promise.then((ret: NullishType): void => { + promise.then((ret: Any): void => { let e = new BusinessError(); e.code = 0; let result = ret as long; -- Gitee