mirror of
https://gitee.com/openharmony/third_party_jsframework
synced 2024-11-27 00:40:37 +00:00
Signed-off-by: fupengfei001 <fupengfei6@huawei.com>
This commit is contained in:
parent
b17b8662e5
commit
256903bace
@ -44,8 +44,14 @@ export function getReturnStatement(returnType: ReturnTypeEntity, sourceFile: Sou
|
||||
return `return '[PC Preview] unkonwn type'`;
|
||||
} else if (returnType.returnKindName === 'String') {
|
||||
return `return ${returnType.returnKindName}(...args)`;
|
||||
} else if (returnType.returnKindName === 'ArrayBuffer') {
|
||||
return `return new ${returnType.returnKindName}(0)`;
|
||||
} else if (returnType.returnKindName.startsWith('Array')) {
|
||||
if (returnType.returnKindName.includes('<') && returnType.returnKindName.includes('>')) {
|
||||
return `return [${generateGenericTypeToMockValue(returnType.returnKindName)}]`;
|
||||
} else {
|
||||
return `return new ${returnType.returnKindName}()`;
|
||||
}
|
||||
} else if (returnType.returnKindName.startsWith('Readonly')) {
|
||||
return `return ${returnType.returnKindName.split('<')[1].split('>')[0]}`;
|
||||
} else if (checkIsGenericSymbol(returnType.returnKindName)) {
|
||||
|
Loading…
Reference in New Issue
Block a user