• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { TypeAliasEntity } from '../declaration-node/typeAliasDeclaration';
17
18/**
19 * generate type alias
20 * @param typeAliasEntity
21 * @param isInner
22 * @returns
23 */
24export function generateTypeAliasDeclaration(typeAliasEntity: TypeAliasEntity, isInner: boolean): string {
25  let typeAliasName = '';
26  if (!isInner) {
27    typeAliasName += `export const ${typeAliasEntity.typeAliasName} = `;
28  } else {
29    typeAliasName += `const ${typeAliasEntity.typeAliasName} = `;
30  }
31  let typeAliasValue = '';
32  typeAliasValue += `'[PC Preview] unkonwn ${typeAliasEntity.typeAliasName}'`;
33  return typeAliasName + typeAliasValue + ';';
34}
35