mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Fix mistakes.
This commit is contained in:
parent
b163b6707b
commit
c68caa00db
@ -267,7 +267,6 @@ function foo7_c(x) {
|
||||
function foo8_c(x) {
|
||||
for (const y = 0; y < 1;) {
|
||||
const x = 1;
|
||||
var
|
||||
var v = x;
|
||||
(function() { return x + y + v });
|
||||
(() => x + y + v);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Class with protected members
|
||||
class C1 {
|
||||
protected x!: number;
|
||||
protected static sx!: number;
|
||||
protected static sx: number;
|
||||
protected f() {
|
||||
return this.x;
|
||||
}
|
||||
@ -23,7 +23,7 @@ class C2 extends C1 {
|
||||
// Derived class making protected members public
|
||||
class C3 extends C2 {
|
||||
x!: number;
|
||||
static sx!: number;
|
||||
static sx: number
|
||||
f() {
|
||||
return super.f();
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ interface someGenerics8 {
|
||||
new <T>(n: T): T;
|
||||
}
|
||||
declare var someGenerics8: someGenerics8;
|
||||
declare var x = new someGenerics8(someGenerics7);
|
||||
var x = new someGenerics8(someGenerics7);
|
||||
new x<string, string, string>(null, null, null);
|
||||
|
||||
// Generic call with multiple parameters of generic type passed arguments with no best common type
|
||||
@ -103,9 +103,9 @@ interface someGenerics9 {
|
||||
new <T>(a: T, b: T, c: T): T;
|
||||
}
|
||||
declare var someGenerics9: someGenerics9;
|
||||
declare var a9a = new someGenerics9('', 0, []);
|
||||
var a9a = new someGenerics9('', 0, []);
|
||||
declare var a9a: {};
|
||||
declare var a9b = new someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null);
|
||||
var a9b = new someGenerics9<{ a?: number; b?: string; }>({ a: 0 }, { b: '' }, null);
|
||||
declare var a9b: { a?: number; b?: string; };
|
||||
|
||||
// Generic call with multiple parameters of generic type passed arguments with multiple best common types
|
||||
@ -117,21 +117,21 @@ interface A92 {
|
||||
x: number;
|
||||
z?: Window;
|
||||
}
|
||||
declare var a9e = new someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' });
|
||||
var a9e = new someGenerics9(undefined, { x: 6, z: window }, { x: 6, y: '' });
|
||||
declare var a9e: {};
|
||||
declare var a9f = new someGenerics9<A92>(undefined, { x: 6, z: window }, { x: 6, y: '' });
|
||||
var a9f = new someGenerics9<A92>(undefined, { x: 6, z: window }, { x: 6, y: '' });
|
||||
declare var a9f: A92;
|
||||
|
||||
// Generic call with multiple parameters of generic type passed arguments with a single best common type
|
||||
declare var a9d = new someGenerics9({ x: 3 }, { x: 6 }, { x: 6 });
|
||||
var a9d = new someGenerics9({ x: 3 }, { x: 6 }, { x: 6 });
|
||||
declare var a9d: { x: number; };
|
||||
|
||||
// Generic call with multiple parameters of generic type where one argument is of type 'any'
|
||||
declare var anyVar: any;
|
||||
declare var a = new someGenerics9(7, anyVar, 4);
|
||||
var a = new someGenerics9(7, anyVar, 4);
|
||||
declare var a: any;
|
||||
|
||||
// Generic call with multiple parameters of generic type where one argument is [] and the other is not 'any'
|
||||
declare var arr = new someGenerics9([], null, undefined);
|
||||
var arr = new someGenerics9([], null, undefined);
|
||||
declare var arr: any[];
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
"use strict"
|
||||
|
||||
declare var interface: number;
|
||||
var interface: number = 123;
|
||||
|
||||
// 'interface' is a strict mode reserved word, and so it would be permissible
|
||||
// to allow 'interface' and the name of the interface to be on separate lines;
|
||||
|
||||
@ -14,5 +14,5 @@ function generic<T extends { x, y }>(t: T) {
|
||||
return rest;
|
||||
}
|
||||
|
||||
let rest: { b: string } = { b: "" }
|
||||
let rest: { b: string } = { b: "" };
|
||||
({a, ...rest.b + rest.b} = o);
|
||||
|
||||
@ -46,8 +46,10 @@ namespace Generics {
|
||||
a3 = b3; // error
|
||||
b3 = a3; // error
|
||||
|
||||
declare var b4: { [x: string]: Derived2; };
|
||||
var b4: { [x: string]: Derived2; };
|
||||
a3 = b4; // error
|
||||
b4 = a3; // error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let x!: string = 123
|
||||
@ -64,7 +64,7 @@ namespace TU {
|
||||
enum E { A }
|
||||
enum F { A }
|
||||
|
||||
function foo3<T>(x: T, a: (x: T) => T, b: (x: any) => any) {
|
||||
function foo3<T>(x: T, a: (x: T) => T, b: (x: U) => U) {
|
||||
var r!: (x: T) => T;
|
||||
return r;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user