-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(jsii): build succeeds using Omit<T, K>
When using the `Omit<T, K>` helper type (a mapped type) on an exported API, `jsii` should detect this and fail, instead of allowing the application to compile. An additional bug caused use of this type to result in a successful exit code from `jsii`, while the `.jsii` file was never written. This has also been fixed. Fixes #1707
- Loading branch information
1 parent
b2aa424
commit 842baa8
Showing
6 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
///!MATCH_ERROR: Illegal "extends" value for an exported API | ||
|
||
export interface FooBar { | ||
readonly foo: string; | ||
readonly bar: string; | ||
} | ||
|
||
// Illegal attempt to extend Omit<T, Key> | ||
export interface BarBaz extends Omit<FooBar, 'foo'> { | ||
readonly baz: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
///!MATCH_ERROR: Illegal "implements" value for an exported API | ||
|
||
export interface FooBar { | ||
readonly foo: string; | ||
readonly bar: string; | ||
} | ||
|
||
// Illegal attempt to implement Omit<T, Key> | ||
export class BarBaz implements Omit<FooBar, 'foo'> { | ||
public readonly bar = 'BAR!'; | ||
public readonly baz: number = 1337; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
///!MATCH_ERROR: Only string-indexed map types are supported | ||
|
||
export interface FooBar { | ||
readonly foo: string; | ||
readonly bar: string; | ||
} | ||
|
||
// Illegal attempt to return Omit<T, Key> | ||
export interface IReturner { | ||
bar(): Omit<FooBar, 'foo'>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
///!MATCH_ERROR: Only string-indexed map types are supported | ||
|
||
export interface FooBar { | ||
readonly foo: string; | ||
readonly bar: string; | ||
} | ||
|
||
// Illegal attempt to accept Omit<T, Key> | ||
export interface IReturner { | ||
bar(opts: Omit<FooBar, 'foo'>): void; | ||
} |