tsc

物理CPU、CPU内核、逻辑CPU概念与查看方法

ぐ巨炮叔叔 提交于 2019-11-26 21:37:56
概念区分 1. 物理CPU 即主板插槽上(物理封装上)的CPU芯片个数。物理cpu数量等于不同physical id的个数。 查看命令: # cat /proc/cpuinfo | grep "physical id" | sort -u | wc -l // 物理CPU个数 2. CPU内核数(cpu cores) 即一颗物理CPU包含的内核数量。一般来说,物理CPU个数 X cpu cores = 逻辑CPU个数。如果不相等则表示支持超线程技术。 查看命令 : # cat /proc/cpuinfo | grep "core id " | sort -u | wc -l // CPU内核数 或: # cat /proc/cpuinfo | grep "cpu cores" | uniq 3. 逻辑CPU 一般情况,一颗物理CPU可以有多个物理内核,加上intel的超线程技术(HT, Hyper-Threading)能够把一个物理处理器(内核)在软件层变成两个逻辑处理器,可以使处理器在某一时刻,同步并行处理更多指令和数据(多个线程),当然了实际效能不可实现双倍提升,毕竟干活的核心只有一个。 查看命令: # cat /proc/cpuinfo | grep "processor" | sort -u | wc -l // 逻辑CPU个数(线程数) 关系 逻辑CPU数量 =

'Cannot redeclare block-scoped variable' in unrelated files

前提是你 提交于 2019-11-26 19:14:07
问题 There is a simple TS package that is used as CommonJS modules and has no exports. TS files are compiled to JS files with the same name and used as require('package/option-foo') . tsconfig.json: { "compilerOptions": { "target": "es5" } } option-foo.ts: declare const GlobalVar: any; function baz() {} if (GlobalVar.foo) GlobalVar.baz = baz; option-bar.ts: declare const GlobalVar: any; function baz() {} if (GlobalVar.bar) GlobalVar.baz = baz; The important part here is that option-foo and option

TypeScript - How to keep compiled files in a separate directory?

做~自己de王妃 提交于 2019-11-26 19:13:14
问题 I'm fairly new to TypeScript, and right now I have .ts files in several places throughought my project structure: app/ |-scripts/ |-app.ts | |-classes/ | |-classA.ts | |-classB.ts | |-controllers/ | |-controllerA.ts | |-controllerB.ts | |-otherStuff/ |-otherstuffA.ts Right now, when my files are compiled, they are compiled to the same directory that the .ts fles are in: app/ |-scripts/ |-app.ts |-app.js | |-classes/ | |-classA.ts | |-classB.ts | |-classA.js | |-classB.js | |-controllers/ | |

Ubuntu Basic Configuration Commands

雨燕双飞 提交于 2019-11-26 16:18:54
1. Update / Upgrade Commands sudo apt-get update : In a nutshell, apt-get update doesn’t actually install new versions of software. Instead, it updates the package lists for upgrades for packages that need upgrading, as well as new packages that have just come to the repositories. sudo apt-get upgrade : will fetch new versions of packages existing on the machine if APT knows about these new versions by way of apt-get update. An update must be performed first so that apt-get knows that new versions of packages are available. sudo apt-get dist-upgrade : will do the same job which is done by apt

How do you produce a .d.ts “typings” definition file from an existing JavaScript library?

拟墨画扇 提交于 2019-11-26 14:00:01
I'm using a lot of libraries both my own and 3rd party. I see the "typings" directory contains some for Jquery and WinRT... but how are they created? Ryan Cavanaugh There are a few options available for you depending on the library in question, how it's written, and what level of accuracy you're looking for. Let's review the options, in roughly descending order of desirability. Maybe It Exists Already Always check DefinitelyTyped ( https://github.com/DefinitelyTyped/DefinitelyTyped ) first. This is a community repo full of literally thousands of .d.ts files and it's very likely the thing you

Typescript primitive types: any difference between the types “number” and “Number” (is TSC case-insensitive)?

六月ゝ 毕业季﹏ 提交于 2019-11-26 13:21:37
问题 I meant to write a parameter of type number , but I misspelled the type, writing Number instead. On my IDE (JetBrains WebStorm) the type Number is written with the same color that is used for the primitive type number , while if I write a name of a class (known or unknown) it uses a different color, so I guess that somehow it recognizes the misspelled type as a correct/almost-correct/sort-of-correct type. When I compile the code, instead of complaining for example that the compiler couldn't

How to consume npm modules from typescript?

与世无争的帅哥 提交于 2019-11-26 12:05:48
问题 I\'m giving a shot at typescript. It works fine at the hello world stage. I\'m now trying to use a npm module : index.ts = import _ = require(\'lodash\') console.log(_.toUpper(\'Hello, world !\')) This doesn\'t work : tsc index.ts -> Cannot find module \'lodash\'. (2307) node-ts index.js -> Cannot find module \'lodash\'. (2307) Looking at typescript documentation and in google didn\'t help. Other S/O questions are either unanswered (here and here) or unrelated. Elements : typescript 1.8