目前,我想要了解关于巴别塔的配置,却得到了迷茫babel-preset-**,也有很多预设的巴贝尔,如env,es2015,react和其他人,我不明白,babel-preset-es2015是需要transpile ES2015代码之前的js代码,因此它可以通过最理解/旧浏览器,怎么样babel-preset-env?
这些预设有什么区别?可以使用env而不使用es2015,反之亦然?当我们需要在项目构建系统中出现这两个预设时,会出现什么情况?
谢谢.
我对 TypeScript 还很陌生,你能解释一下这些类型断言方法之间的区别吗:
// 1. Using :
let myStr: string;
// 2. Using as
let strLength = (myStr as string).length;
// 3. Using <> on left side
let strLength = <string>myStr.length;
// 4. Using <> on right side
let myObs: Observable<number>
Run Code Online (Sandbox Code Playgroud)
什么时候使用一个而不是其他?谢谢
在我的机器(Windows 10)中,有两个Java版本,Java 1.8(JRE和JDK)和Java 10(JRE和JDK)。
以前,如果我将Eclipse设置为:
如果我使用以下Spring代码,则
import javax.annotation.PostConstruct;
...
...
...
@PostConstruct
...
...
Run Code Online (Sandbox Code Playgroud)
一切正常。完全没有错误。
但是,如果我将Eclipse设置为:
现在,该import语句抛出一条错误消息:
The import javax.annotation.PostConstruct cannot be resolved
Run Code Online (Sandbox Code Playgroud)
而这个错误也发生在@PreDestroy注释了。
为什么会这样呢?Java 10会发生什么?如果我仍想将Java编译器和JRE系统库版本保留为Java 10,如何解决此问题?
谢谢。
众所周知,以下内容不会运行a()函数,因此不会出现警告框
// 1st
function a() {
alert('A!');
return function() {
alert('B!');
};
};Run Code Online (Sandbox Code Playgroud)
我们知道以下代码将运行a()函数和警告框'A!' 会出现
// 2nd
function a() {
alert('A!');
return function() {
alert('B!');
};
};
a(); // calling functionRun Code Online (Sandbox Code Playgroud)
但是,如果我们运行以下代码,将调用a()函数并且警告框'A!' 也会出现,就像上面的第二个代码一样
// 3rd
function a() {
alert('A!');
return function() {
alert('B!');
};
};
var x = a(); // assigning function to new variableRun Code Online (Sandbox Code Playgroud)
问题: 为什么会发生这种情况(第3段)?我们还没有调用a()函数(我目前的理解).我们不是只是将x分配给()函数吗?
我刚刚更新了我的 VSCode,这是我的 VSCode 的最新更新版本
Version 1.19.2
Commit 490ef761b76b3f3b3832eff7a588aac891e5fe80
Date 2018-01-10T15:55:03.538Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64
Run Code Online (Sandbox Code Playgroud)
我不太确定我的 VSCode 的先前版本,但是由于更新,自动导入功能不再起作用。
例如,在app.module.ts文件中(在 Angular 2+ 项目中),当我输入时,左侧栏FormsModule上没有light bulb icon可以单击以自动导入FormsModule的内容@angular/forms,在以前的版本中它可以正常工作,但有时无法正常工作,但在重新启动 vscode 后,问题通常已解决,但在当前版本中,即使重新启动 vscode 后问题仍然存在,为什么会发生这种情况?如何解决这个问题?
假设我有这个代码:
// Male will inherit ALL of the Human properties
function Human(x, y) {
// Following properties will be inherited
this.name = x;
this.age = y;
this.test = "Test 1";
}
// Following properties will ALSO be inherited
Human.prototype.citizen = "USA";
Human.prototype.employer = "Google";
Human.prototype.test = "Test 2";
function Male(x, y) {
// Following properties will be the own properties of Male instances
this.name = x;
this.age = y;
this.gender = "Male";
}
// Inheritance - Connecting Male object with …Run Code Online (Sandbox Code Playgroud)在我的 angular 组件上,我使用了来自 RxJs 的两种方法,debounceTime()以及distinctUntilChanged()
import { Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';
@Component({
selector: 'app-form4th',
templateUrl: './form4th.component.html',
})
export class Form4thComponent implements OnInit {
searchField: FormControl;
searches: string[] = [];
constructor() { }
ngOnInit() {
this.searchField = new FormControl();
this.searchField
.valueChanges
.debounceTime(400)
.distinctUntilChanged()
.subscribe(term => {
this.searches.push(term);
});
}
}
Run Code Online (Sandbox Code Playgroud)
应用程序工作正常,在执行(构建)ie 时没有错误甚至没有警告消息ng serve,并且在浏览器上运行应用程序按预期工作,并且在浏览器控制台上也没有错误消息或警告。
但是,我的 vscode 上有一条奇怪的 TSLint 消息说:
[ts] Property …
我不太明白的意思-u的git push -u origin master命令.你能解释它的用途吗?
javascript ×5
typescript ×2
angular ×1
babeljs ×1
casting ×1
eclipse ×1
git ×1
java ×1
rxjs ×1
spring ×1
spring-mvc ×1
tslint ×1
webpack ×1