Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b40284c
Change type-only semantics to allow type queries
andrewbranch Jan 8, 2020
2ae9edc
Don’t error using type-only import in ambient context
andrewbranch Jan 8, 2020
db93eb2
Fix default import
andrewbranch Jan 8, 2020
a2548c8
Fix namespace import
andrewbranch Jan 8, 2020
8d3f167
Update more baselines
andrewbranch Jan 8, 2020
b56ad7d
Prevent circular resolution
andrewbranch Jan 8, 2020
0547a3d
Track const enum expression usage
andrewbranch Jan 9, 2020
124dcd6
Update baselines
andrewbranch Jan 9, 2020
2dd3690
Perf tuning 1
andrewbranch Jan 10, 2020
eefa335
Test commit for perf impact
andrewbranch Jan 10, 2020
9a24cba
Weave type-only alias declaration finding into alias resolution
andrewbranch Jan 13, 2020
875349d
Fix namespace import of type-only exported symbols
andrewbranch Jan 14, 2020
171e314
type-only exports do not contribute to the module object type
andrewbranch Jan 14, 2020
910dd84
Update APIs
andrewbranch Jan 14, 2020
2a7c472
Fix enum casing, remove type-only conversion suggestion
andrewbranch Jan 14, 2020
11ba11a
Short circuit type-only checks in resolveEntityName faster
andrewbranch Jan 14, 2020
0c28994
Fix casing in API
andrewbranch Jan 14, 2020
40a2c3c
Remove unused parameter
andrewbranch Jan 14, 2020
1cbfb81
Merge branch 'master' into type-only-2
andrewbranch Jan 14, 2020
124d746
Fix error on qualified names in type queries
andrewbranch Jan 14, 2020
bbbcbd5
Merge branch 'master' into type-only-2
andrewbranch Jan 15, 2020
1044c5c
Allow type-only imports in computed property names
andrewbranch Jan 15, 2020
a5ca492
Fix computed property names of types and abstract members
andrewbranch Jan 16, 2020
8571a8a
Remove unused util
andrewbranch Jan 16, 2020
8b4c235
Commit missing baselines
andrewbranch Jan 16, 2020
be5f50f
Merge branch master into type-only-2
andrewbranch Jan 21, 2020
19b3206
Rename “check” functions so as not to overload the word “check”
andrewbranch Jan 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Commit missing baselines
  • Loading branch information
andrewbranch committed Jan 16, 2020
commit 8b4c2355df58bcfe0a8df89fc22b45d7ed7ee14b
60 changes: 60 additions & 0 deletions tests/baselines/reference/computedPropertyName.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
tests/cases/conformance/externalModules/typeOnly/component.ts(12,4): error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
tests/cases/conformance/externalModules/typeOnly/component.ts(16,4): error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
tests/cases/conformance/externalModules/typeOnly/component.ts(20,4): error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
tests/cases/conformance/externalModules/typeOnly/component.ts(24,4): error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.


==== tests/cases/conformance/externalModules/typeOnly/framework-hooks.ts (0 errors) ====
export const onInit = Symbol("onInit");

==== tests/cases/conformance/externalModules/typeOnly/component.ts (4 errors) ====
import type { onInit } from "./framework-hooks";

interface Component {
[onInit]?(): void;
}

type T = {
[onInit]: any;
}

const o = {
[onInit]: 0 // Error
~~~~~~
!!! error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
!!! related TS1376 tests/cases/conformance/externalModules/typeOnly/component.ts:1:15: 'onInit' was imported here.
};

class C {
[onInit]: any; // Error (because class fields)
~~~~~~
!!! error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
!!! related TS1376 tests/cases/conformance/externalModules/typeOnly/component.ts:1:15: 'onInit' was imported here.
}

class D {
[onInit] = 0; // Error
~~~~~~
!!! error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
!!! related TS1376 tests/cases/conformance/externalModules/typeOnly/component.ts:1:15: 'onInit' was imported here.
}

class E {
[onInit]() {} // Error
~~~~~~
!!! error TS1361: 'onInit' cannot be used as a value because it was imported using 'import type'.
!!! related TS1376 tests/cases/conformance/externalModules/typeOnly/component.ts:1:15: 'onInit' was imported here.
}

abstract class F {
abstract [onInit](): void;
}

class G {
declare [onInit]: any;
}

declare class H {
[onInit]: any;
}

51 changes: 51 additions & 0 deletions tests/baselines/reference/computedPropertyName.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,59 @@ import type { onInit } from "./framework-hooks";
interface Component {
[onInit]?(): void;
}

type T = {
[onInit]: any;
}

const o = {
[onInit]: 0 // Error
};

class C {
[onInit]: any; // Error (because class fields)
}

class D {
[onInit] = 0; // Error
}

class E {
[onInit]() {} // Error
}

abstract class F {
abstract [onInit](): void;
}

class G {
declare [onInit]: any;
}

declare class H {
[onInit]: any;
}


//// [framework-hooks.js]
export const onInit = Symbol("onInit");
//// [component.js]
var _a;
const o = {
[onInit]: 0 // Error
};
class C {
}
class D {
constructor() {
this[_a] = 0; // Error
}
}
_a = onInit;
class E {
[onInit]() { } // Error
}
class F {
}
class G {
}
65 changes: 65 additions & 0 deletions tests/baselines/reference/computedPropertyName.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,68 @@ interface Component {
>onInit : Symbol(onInit, Decl(component.ts, 0, 13))
}

type T = {
>T : Symbol(T, Decl(component.ts, 4, 1))

[onInit]: any;
>[onInit] : Symbol([onInit], Decl(component.ts, 6, 10))
>onInit : Symbol(onInit, Decl(component.ts, 0, 13))
}

const o = {
>o : Symbol(o, Decl(component.ts, 10, 5))

[onInit]: 0 // Error
>[onInit] : Symbol([onInit], Decl(component.ts, 10, 11))
>onInit : Symbol(onInit, Decl(component.ts, 0, 13))

};

class C {
>C : Symbol(C, Decl(component.ts, 12, 2))

[onInit]: any; // Error (because class fields)
>[onInit] : Symbol(C[onInit], Decl(component.ts, 14, 9))
>onInit : Symbol(onInit, Decl(component.ts, 0, 13))
}

class D {
>D : Symbol(D, Decl(component.ts, 16, 1))

[onInit] = 0; // Error
>[onInit] : Symbol(D[onInit], Decl(component.ts, 18, 9))
>onInit : Symbol(onInit, Decl(component.ts, 0, 13))
}

class E {
>E : Symbol(E, Decl(component.ts, 20, 1))

[onInit]() {} // Error
>[onInit] : Symbol(E[onInit], Decl(component.ts, 22, 9))
>onInit : Symbol(onInit, Decl(component.ts, 0, 13))
}

abstract class F {
>F : Symbol(F, Decl(component.ts, 24, 1))

abstract [onInit](): void;
>[onInit] : Symbol(F[onInit], Decl(component.ts, 26, 18))
>onInit : Symbol(onInit, Decl(component.ts, 0, 13))
}

class G {
>G : Symbol(G, Decl(component.ts, 28, 1))

declare [onInit]: any;
>[onInit] : Symbol(G[onInit], Decl(component.ts, 30, 9))
>onInit : Symbol(onInit, Decl(component.ts, 0, 13))
}

declare class H {
>H : Symbol(H, Decl(component.ts, 32, 1))

[onInit]: any;
>[onInit] : Symbol(H[onInit], Decl(component.ts, 34, 17))
>onInit : Symbol(onInit, Decl(component.ts, 0, 13))
}

68 changes: 68 additions & 0 deletions tests/baselines/reference/computedPropertyName.types
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,71 @@ interface Component {
>onInit : unique symbol
}

type T = {
>T : T

[onInit]: any;
>[onInit] : any
>onInit : unique symbol
}

const o = {
>o : { [onInit]: number; }
>{ [onInit]: 0 // Error} : { [onInit]: number; }

[onInit]: 0 // Error
>[onInit] : number
>onInit : unique symbol
>0 : 0

};

class C {
>C : C

[onInit]: any; // Error (because class fields)
>[onInit] : any
>onInit : unique symbol
}

class D {
>D : D

[onInit] = 0; // Error
>[onInit] : number
>onInit : unique symbol
>0 : 0
}

class E {
>E : E

[onInit]() {} // Error
>[onInit] : () => void
>onInit : unique symbol
}

abstract class F {
>F : F

abstract [onInit](): void;
>[onInit] : () => void
>onInit : unique symbol
}

class G {
>G : G

declare [onInit]: any;
>[onInit] : any
>onInit : unique symbol
}

declare class H {
>H : H

[onInit]: any;
>[onInit] : any
>onInit : unique symbol
}