-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(jsii): incorrectly allowed unexported type in constructor params (#…
…3147) The compiler incorrectly allowed un-epxorted types to be used in a constructor parameter, resulting in invalid assemblies (where a reference to the un-exported type exists, but the type itself does not). Added a test that validates this is now checked against, and improved the error experience by providing source anchors for where the problematic type is being used. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
- Loading branch information
Romain Marcadier
committed
Nov 10, 2021
1 parent
75e4093
commit 7cd59fc
Showing
5 changed files
with
119 additions
and
15 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 @@ | ||
/** | ||
* This should never be exported by the modules that import it. | ||
*/ | ||
export interface UnexportedProps { | ||
readonly name: string; | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/jsii/test/negatives/neg.expose-unexported-type-constructor-param.ts
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,9 @@ | ||
import { UnexportedProps } from './_unexported'; | ||
|
||
export class ExportedClass { | ||
public readonly name: string; | ||
|
||
public constructor(props: UnexportedProps) { | ||
this.name = props.name; | ||
} | ||
} |