tsc

Getting TSC rate in x86 kernel

感情迁移 提交于 2019-12-19 08:11:42
问题 I have an embedded Linux system running on an Atom, which is a new enough CPU to have an invariant TSC (time stamp counter), whose frequency the kernel measures on startup. I use the TSC in my own code to keep time (avoiding kernel calls), and my startup code measures the TSC rate, but I'd rather just use the kernel's measurement. Is there any way to retrieve this from the kernel? It's not in /proc/cpuinfo anywhere. 回答1: I had a brief look and there doesn't seem to be a built-in way to

TypeScript compilation of RequireJS module generates line Object.defineProperty(exports, “__esModule”, { value: true }); How to get rid of it?

坚强是说给别人听的谎言 提交于 2019-12-19 06:18:07
问题 This is how my tsconfig.json file looks: { "compileOnSave": true, "compilerOptions": { "module": "amd", "noImplicitAny": false, "removeComments": false, "preserveConstEnums": true, "strictNullChecks": true, "sourceMap": false } } I have a typescript file named a.ts which is an AMD module (I'm using requirejs), which looks like: export function a() { var a = { b: 5 }; return a; } The compiled Javascript files looks like: define(["require", "exports"], function (require, exports) { "use strict"

'tsc command not found' in compiling typescript

非 Y 不嫁゛ 提交于 2019-12-18 13:50:46
问题 I want to install typescript, so I used the following command: npm install -g typescript and test tsc --version , but it just show 'tsc command not found'. I have tried many ways as suggested in stackoverflow, github and other sites. but it doesn't work. How could I know typescript is installed and where it is. my OS is Unix, OS X El Capitan 10.11.6, node version is 4.4.3, npm version is 3.10.5 回答1: A few tips in order restart the terminal restart the machine reinstall nodejs + then run npm

TypeScript: compiling removes unreferenced imports

狂风中的少年 提交于 2019-12-18 11:41:19
问题 In our project we're using RequireJS as our module loader. Some of our modules will influence global libraries, and hence won't be directly used within the module they are referenced in. Example: define(['definitely/goingto/usethis/','just/referencingthis/forpackaging'], function(useThis) { useThis.likeIPromised(); // the following call can only be made when the second required file is available someGlobalAvailableVariable.someMethod(); }); This works as expected when writing my modules in

Can't find Typescript compiler: Command “tsc” is not valid

一笑奈何 提交于 2019-12-18 10:58:38
问题 Just installed Typescript extension to VS2012 and followed Install TypeScript for Visual Studio 2012 and then the tutorial to call the compiler: > tsc greeter.ts But when i try to compile .ts file where should i type: tsc greeter.ts ? Tried it in VS command line and in windows console, always get the message that tsc is not recognized as command( Command "tsc" is not valid. ). 回答1: Ensure you have, C:\Program Files (x86)\Microsoft SDKs\TypeScript\0.8.0.0 or, C:\Program Files\Microsoft SDKs

@Types/Sequelize Error TS1086: An accessor cannot be declared in ambient context

孤人 提交于 2019-12-18 09:00:56
问题 I have a project that shows this error when I run 'tsc': ../modules/node_modules/sequelize/types/lib/transaction.d.ts:33:14 - error TS1086: An accessor cannot be declared in an ambient context. 33 static get LOCK(): LOCK; ~~~~ ../modules/node_modules/sequelize/types/lib/transaction.d.ts:40:7 - error TS1086: An accessor cannot be declared in an ambient context. 40 get LOCK(): LOCK; ~~~~ My versions are: "@types/sequelize": "^4.28.6" "sequelize": "^5.8.10" "sequelize-typescript": "1.0.0-beta.4"

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

会有一股神秘感。 提交于 2019-12-17 02:35:08
问题 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? 回答1: 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

tsc is not recognized as an internal or external command

隐身守侯 提交于 2019-12-13 16:45:16
问题 I am using node version 6.9.2 with npm version 5.4.2 on Windows7. I have installed typescript with the command npm install typescript -g . However, when I run a demo file using command, tsc , I get an error: "tsc is not recognized as an internal or external command". Could anybody help? Other node modules get installed correctly and working fine. Not sure why typescript isn't working. 回答1: The problem is likely that tsc is not in the system path. First, check if tsc is installed correctly.

TypeScript require one parameter or the other, but not neither

有些话、适合烂在心里 提交于 2019-12-13 03:35:58
问题 Say I have this type: export interface Opts { paths?: string | Array<string>, path?: string | Array<string> } I want to tell the user that they must pass either paths or path, but it is not necessary to pass both. Right now the problem is that this compiles: export const foo = (o: Opts) => {}; foo({}); does anyone know to allow for 2 or more optional but at least 1 is necessary parameters with TS? 回答1: You may use export type Opts = { path: string | Array<string> } | { paths: string | Array

Typescript import ts file from node module

允我心安 提交于 2019-12-13 02:02:25
问题 Maybe it's a duplicate but I've searched for an hour and haven't found the answer. I have a node module named a-module which contains some .ts files (for example a.ts ) I have another node module b-module which has a-module among its dependencies. I want to import some .ts file from a-module to b-module . In some file within b-module I write: import a = require('a-module/a'); console.log(a); When then I'm trying to compile b-module with tsc, is says Cannot find external module 'a-module/a'.