Typescript Type 'number' 不可分配给 type 'string' // 'HTMLInputElement' 类型的参数不可分配给 'string' 类型的参数

时间:2021-01-21 15:30:53

标签: typescript

import static net.logstash.logback.argument.StructuredArguments.v;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.info.BuildProperties;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

@RestController
public class VersionController {

    final static Logger log = LoggerFactory.getLogger(AppInfoController.class);

    private Properties versionProperties = new Properties();

    private String gitLastTag;
    private String gitHash;
    private String gitBranchName;
    private String gitIsCleanTag;

    VersionController()
    {
        String AllGitVersionProperties = "";
        InputStream inputStream = getClass().getClassLoader().getResourceAsStream("classpath:/version.properties");

        if(inputStream == null)
        {
            // When running unit tests, no jar is built, so we load a copy of the file that we saved during build.gradle.
            // Possibly this also is the case during debugging, therefore we save in bin/main instead of bin/test.
            try {
                inputStream = new FileInputStream("bin/main/version.properties");
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        try {
            versionProperties.load(inputStream);
        } catch (IOException e) {
            AllGitVersionProperties += e.getMessage()+":";
            log.error("Could not load classpath:/version.properties",e);
        }

        gitLastTag = versionProperties.getProperty("gitLastTag","last-tag-not-found");
        gitHash = versionProperties.getProperty("gitHash","git-hash-not-found");
        gitBranchName = versionProperties.getProperty("gitBranchName","git-branch-name-not-found");
        gitIsCleanTag = versionProperties.getProperty("gitIsCleanTag","git-isCleanTag-not-found");

        Set<Map.Entry<Object, Object>> mainPropertiesSet = versionProperties.entrySet();
        for(Map.Entry oneEntry : mainPropertiesSet){
            AllGitVersionProperties += "+" + oneEntry.getKey()+":"+oneEntry.getValue();
        }
         log.info("All Git Version-Properties:",v("GitVersionProperties", AllGitVersionProperties));
    }
}

TypeScipt Code

“HTMLInputElement”类型的错误代码参数不可分配给“字符串”类型的参数

类型 'number' 不能分配给类型 'string

html Code

0 个答案:

没有答案