导出不透明类

时间:2018-08-14 23:50:53

标签: flowtype opaque-pointers

我在流can中执行以下操作:

#!/bin/bash

set -e;
current_dir=$PWD

# check if argument has been supplied
if [ $# -eq 0 ]; then
    echo "Please pass a directory";
    exit 1;
# declare $PASSED variable as the supplied argument
else
    PASSED=$1;
fi

# Check if passed argument is a directory
if [ -d "${PASSED}" ]; then
    git_directory=false;
    # for every directory with .git in it
    find . -name ".git"|while read fname; do
        #TODO: FIND BETTER WAY FOR THIS
        git_directory=true;
        cd "$current_dir/$fname";
        cd ..;
        echo "Pulling from remote repo";
        git pull origin master;
        cd "$current_dir";
    done
    if ! "$git_directory"; then
        echo "No git directories were found, are you sure you gave the correct directory?";
        exit 1;
    fi

else
    echo "Please pass a directory";
    exit 1;
fi

但是我想将其导出为interface IC { get value(): { x: number }; } class C implements IC { value = { x: 7, y: 42 }; doSmth() { console.log(this.value.x, this.value.y); } } export opaque type CC: IC = C; ,而不是C

CC

但是我得到一个错误

export opaque type C: IC = C;

如何解决将其导出为与接口匹配的不透明类型而不重命名的问题?

我还需要一个构造函数,以便能够执行13: export opaque type C: IC = C; ^ Cannot declare `C` [1] because the name is already bound. References: 5: class C implements IC { ^ [1]

0 个答案:

没有答案