Visual Studio Code始终使用旧版本的tsc

时间:2018-03-12 17:16:32

标签: visual-studio-code tsc

我使用typescript作为为网页创建javascript的一种方式。我第一次尝试使用tsc编译器产生了错误TS1005错误的';'。这显然是因为Visual Studio Code使用旧版本的tsc。

我发现我的系统上有两个版本(在命令窗口中使用tsc发现):

  <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

        <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list>
                    <value>file:${activemq.conf}/credentials.properties</value>
                    <value>file:${activemq.conf}/jdbc.properties</value>
                </list>
            </property>
        </bean>

       <!-- Allows accessing the server log -->
        <bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
              lazy-init="false" scope="singleton"
              init-method="start" destroy-method="stop">
        </bean>

        <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">

            <destinationPolicy>
                <policyMap>
                  <policyEntries>
                    <policyEntry topic=">" producerFlowControl="true">

                      <pendingMessageLimitStrategy>
                        <constantPendingMessageLimitStrategy limit="1000"/>
                      </pendingMessageLimitStrategy>
                    </policyEntry>
                  </policyEntries>
                </policyMap>
            </destinationPolicy>


            <managementContext>
                <managementContext createConnector="true"/>
            </managementContext>


            <persistenceAdapter>
                <jdbcPersistenceAdapter dataDirectory="${base}/data/" dataSource="#oracle-ds">
                    <statements>
                        <statements tablePrefix="AMQ_"/>
                    </statements>
                </jdbcPersistenceAdapter>
            </persistenceAdapter>


              <systemUsage>
                <systemUsage>
                    <memoryUsage>
                        <memoryUsage percentOfJvmHeap="70" />
                    </memoryUsage>
                    <storeUsage>
                        <storeUsage limit="100 gb"/>
                    </storeUsage>
                    <tempUsage>
                        <tempUsage limit="50 gb"/>
                    </tempUsage>
                </systemUsage>
            </systemUsage>

            <transportConnectors>
                <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
                  <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
                <transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/>
            </transportConnectors>

            <!-- destroy the spring context on shutdown to stop jetty -->
            <shutdownHooks>
                <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
            </shutdownHooks>

        </broker>

     <import resource="jetty.xml"/>

        <bean id="oracle-ds" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
            <property name="url" value="${url} />
            <property name="username" value="${oracle.jdbc.username}"/>
            <property name="password" value="${oracle.jdbc.password}"/>
            <property name="maxTotal" value="20"/>  
            <property name="poolPreparedStatements" value="true"/>
          </bean>
    </beans>

其中第一个位置包含版本1.0.3.0,第二个版本包含2.7.2。

我能让VS Code使用最新版本的唯一方法是输入完整路径,即

C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\tsc.exe
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\tsc.js
C:\Users\my_user_name\AppData\Roaming\npm\tsc
C:\Users\my_user_name\AppData\Roaming\npm\tsc.cmd

进入终端窗口。当我这样做时,没有TS1005错误。

如果有人可以用简单的术语解释VS Code新手如何设置它以便自动获取新版本的tsc,我将非常感激。

感谢建议。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。

但是,将文件夹名称“ C:\ Program Files(x86)\ Microsoft SDKs \ TypeScript \ 1.0”更改为1.0以外的其他名称(例如:1.0.Original)对我来说有效。

相关问题