5 lines
4.4 KiB
JSON
5 lines
4.4 KiB
JSON
{
|
|
"id": "guide/migration-update-libraries-tslib",
|
|
"title": "tslib direct dependency migration",
|
|
"contents": "\n\n\n<div class=\"github-links\">\n <a href=\"https://github.com/angular/angular/edit/master/aio/content/guide/migration-update-libraries-tslib.md?message=docs%3A%20describe%20your%20change...\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n</div>\n\n\n<div class=\"content\">\n <h1 id=\"tslib-direct-dependency-migration\"><code>tslib</code> direct dependency migration<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"guide/migration-update-libraries-tslib#tslib-direct-dependency-migration\"><i class=\"material-icons\">link</i></a></h1>\n<h2 id=\"what-does-this-migration-do\">What does this migration do?<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"guide/migration-update-libraries-tslib#what-does-this-migration-do\"><i class=\"material-icons\">link</i></a></h2>\n<p>If you have any libraries within your workspace, this migration will convert <code>tslib</code> peer dependencies to direct dependencies for the libraries.\nTypeScript uses the <code>tslib</code> package to provide common helper functions used in compiled TypeScript code.\nThe <code>tslib</code> version is also updated to <code>2.0.0</code> to support TypeScript 3.9.</p>\n<p>Before:</p>\n<code-example language=\"json\">\n{\n \"name\": \"my-lib\",\n \"version\": \"0.0.1\",\n \"peerDependencies\": {\n \"@angular/common\": \"^9.0.0\",\n \"@angular/core\": \"^9.0.0\",\n \"tslib\": \"^1.12.0\"\n }\n}\n</code-example>\n<p>After:</p>\n<code-example language=\"json\">\n{\n \"name\": \"my-lib\",\n \"version\": \"0.0.1\",\n \"peerDependencies\": {\n \"@angular/common\": \"^9.0.0\",\n \"@angular/core\": \"^9.0.0\"\n },\n \"dependencies\": {\n \"tslib\": \"^2.0.0\"\n }\n}\n</code-example>\n<h2 id=\"why-is-this-migration-necessary\">Why is this migration necessary?<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"guide/migration-update-libraries-tslib#why-is-this-migration-necessary\"><i class=\"material-icons\">link</i></a></h2>\n<p>The <a href=\"https://github.com/Microsoft/tslib\"><code>tslib</code></a> is a runtime library for Typescript.\nThe version of this library is bound to the version of the TypeScript compiler used to compile a library.\nPeer dependencies do not accurately represent this relationship between the runtime and the compiler.\nIf <code>tslib</code> remained declared as a library peer dependency, it would be possible for some Angular workspaces to get into a state where the workspace could not satisfy <code>tslib</code> peer dependency requirements for multiple libraries, resulting in build-time or run-time errors.</p>\n<p>As of TypeScript 3.9 (used by Angular v10), <code>tslib</code> version of 2.x is required to build new applications.\nHowever, older libraries built with previous version of TypeScript and already published to npm might need <code>tslib</code> 1.x.\nThis migration makes it possible for code depending on incompatible versions of the <code>tslib</code> runtime library to remain interoperable.</p>\n<h2 id=\"do-i-still-need-tslib-as-a-dependency-in-my-workspace-packagejson\">Do I still need <code>tslib</code> as a dependency in my workspace <code>package.json</code>?<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"guide/migration-update-libraries-tslib#do-i-still-need-tslib-as-a-dependency-in-my-workspace-packagejson\"><i class=\"material-icons\">link</i></a></h2>\n<p>Yes.\nThe <code>tslib</code> dependency declared in the <code>package.json</code> file of the workspace is used to build applications within this workspace, as well as run unit tests for workspace libraries, and is required.</p>\n\n \n</div>\n\n<!-- links to this doc:\n-->\n<!-- links from this doc:\n - guide/migration-update-libraries-tslib#do-i-still-need-tslib-as-a-dependency-in-my-workspace-packagejson\n - guide/migration-update-libraries-tslib#tslib-direct-dependency-migration\n - guide/migration-update-libraries-tslib#what-does-this-migration-do\n - guide/migration-update-libraries-tslib#why-is-this-migration-necessary\n - https://github.com/Microsoft/tslib\n - https://github.com/angular/angular/edit/master/aio/content/guide/migration-update-libraries-tslib.md?message=docs%3A%20describe%20your%20change...\n-->"
|
|
} |