tsc

Declare dynamically added class properties in TypeScript

大兔子大兔子 提交于 2019-11-30 08:31:42
问题 I want to assign properties to the instance of a class without knowing the property names, values and types of values in TypeScript. Lets assume we have the following example.ts script: // This could be a server response and could look totally diffent another time... const someJson:string = '{ "foo": "bar", "bar": "baz" }' class MyClass { someProperty:boolean constructor( json:string ) { const parsedJson:any = JSON.parse( json ) Object.keys( parsedJson ).forEach( ( key:string ) => { this[ key

TypeScript: compiling removes unreferenced imports

陌路散爱 提交于 2019-11-30 04:15:48
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 JavaScript. However, we're translating our project step by step to TypeScript. Given the example above,

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

◇◆丶佛笑我妖孽 提交于 2019-11-30 01:44:02
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. ). Ensure you have, C:\Program Files (x86)\Microsoft SDKs\TypeScript\0.8.0.0 or, C:\Program Files\Microsoft SDKs\TypeScript\0.8.0.0 on your path. If not, try restarting CMD.EXE and see if shows up with a fresh copy. If that

tsc官网,TSC条码机官方网站,TSC条码打印机客服

风流意气都作罢 提交于 2019-11-29 23:32:49
选择打印机一定要注意品牌,它关系到一个机子的售后服务问题,对于广州条码打印机品牌来说,类型有很多,牌子也有很都,对于国内打印机市场来说,它的供货渠道是非常多的,因此在这方面也有不少海外货可以选择,与国内货相比,海外货的优势 比较明显,质量好,售后服务有保障,不过对于一些品牌效益比较小的机子来说,它的售后服务并不是很全面,因此如果是在大城市使用的话,还是要考虑大品牌,那么得到的售后服务有保障,可以随时与商家进行沟通,而且选购的时候可以货比三家。 -------- 手机:18998295272 QQ:1061717801 -------- TSC条码打印机,专指台湾半导体品牌的条码打印机,是台湾半导体股份有限公司在机械设备领域发展的一个产业。  目前,市场上流行的品牌条码打印机,除了TSC条码打印机,还有:斑马条码打印机、TEC条码打印机、西铁城条码打印机等等。 品牌特色 我们的产品,从入门等级的桌上型条形码打印机到高效能的工业型以及便携式的卷标打印机,TSC延续着过去近20年来的经营理念,始终坚持以人性化、稳定度、耐用性为产品设计的基本原则。TSC条形码打印机没有浮华耀眼的行销包装,取而代之的是,兢兢业业的品质坚持。藉由ISO9001品保系统的落实执行,我们不断地鞭策自已朝向「产品零故障」的目标努力。 技术原理 热转印技术:简单的说,就是利用专门的碳带,透过类似传真机打印头的工作原理

Is there a way to use npm scripts to run tsc -watch && nodemon --watch?

不羁岁月 提交于 2019-11-29 22:56:58
I'm looking for a way to use npm scripts to run tsc --watch && nodemon --watch at the same time. I can run this commands independently, but when I want run both of them, only the first one is executed. eg. if I have this script: "scripts": { "runDeb": "set NODE_ENV=development&& tsc --watch && nodemon --watch" } tsc --watch is executed but nodemon is never called, and vice versa. I think what you want is something like this (my current setup): "scripts": { "compile": "tsc && node app.js", "dev": "./node_modules/nodemon/bin/nodemon.js -e ts --exec \"npm run compile\"" } I created two scripts

typeScript

落花浮王杯 提交于 2019-11-29 17:46:05
day1 1.安装、编译 npm install -g typescript tsc xx.ts 2.ts快速生成js文件 a.目录文件下命令行输入tsc --init 生成tsconfig.json文件 改'outDir':'./js' b.在vscode里点击终端->运行任务 监视tsc:watch-tsconfig.json day2/day3 1.typscript数据类型 布尔类型(boolean) 数字类型(number) 字符串类型(string) 数组类型(array) 元祖类型(tuple) 枚举类型(enum) 任意类型(any) null 和 undefined void类型 nerver类型 2.为了使代码规范、更有利于维护、增加了类型校验、写ts代码必须指定类型 day4 来源: https://www.cnblogs.com/qxp140605/p/11525204.html

Typescript “error TS2532: Object is possibly 'undefined'” even after undefined check

五迷三道 提交于 2019-11-29 13:12:40
I'm trying to use the --strict option on tsc but I ran into the following "weird" case that I don't seem to understand. If I write: function testStrict(input: {query?: {[prop: string]: string}}) { if (input.query) { Object.keys(input.query).forEach(key => { input.query[key]; }) } return input; } the compiler complains about: test.ts(5,9): error TS2532: Object is possibly 'undefined'. (the offending line is input.query[key]; ) What I don't understand is, I have already checked for undefined with the if guard on the first line of the function if (input.query) , so why does the compiler think it

Missing *.ts files (due to `npm link` ?)

痴心易碎 提交于 2019-11-29 12:50:08
问题 I have this import statement in an Angular5 project: import {plugins, SCECodeGenType} from 'sce-plugins/code-generation'; this resolves to this path on my filesystem: /Users/.../suman-chrome-extension/node_modules/sce-plugins/code-generation/index.d.ts When building the app with ng build -w , I get this error: ERROR in ../sce-plugins/code-generation/index.ts Module build failed: Error: /Users/alexamil/WebstormProjects/oresoftware/sumanjs/sce-plugins/code-generation/index.ts is missing from

Does TypeScript provide an explicit Public API for NodeJS Module Access?

十年热恋 提交于 2019-11-29 12:38:35
问题 From within a node app I would like to do: var typeScript = require('typescript'); typeScript.compile('...') I'm looking to implement the compiler into a build system but without access to a public API (typescript.compile, etc) this is impossible. Here's a more complete example of what I would like to do, though the below is for LiveScript, not TypeScript, utilitized in a plugin written for the Brunch.io build-system: LiveScript = require 'LiveScript' sysPath = require 'path' module.exports =

Building a class registry: Cannot use 'new' with an expression whose type lacks a call or construct signature

一世执手 提交于 2019-11-29 08:54:14
I have this setup: //./things/Base.ts export default class Base{ constructor(){ console.log("HI I AM A BASE THING"); } } //things.ts import Base = require('./things/Base'); export = { defaultThing: Base }; //entry.ts import Things = require('./things'); new Things.defaultThing(); What I'm trying to do is build a dictionary with the keys I want for classes of a given type, letting me change the underlying implementation without touching the consuming code. This fails with the following message λ tsc entry.ts entry.ts(3,1): error TS2351: Cannot use 'new' with an expression whose type lacks a