Anonymous
Как исправить ошибку index.d.ts d3-dag при создании приложения Angular
Сообщение
Anonymous » 28 мар 2024, 13:03
У меня запущено приложение Angular 12, и я установил d3 и d3-dag для создания графиков. Но я получаю ошибки в файле node_modules/d3-dag....index.d.ts.
Версия Angular: 12.2.16
Версия Node.js: 14.16. 1
Версия d3: 7.8.5
Версия d3-dag: 1.1.0
package.json
Код: Выделить всё
{
"name": "client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"dev": "ng serve --proxy-config proxy.config.json --live-reload true",
"build": "ng build --configuration production --aot --output-hashing none --vendor-chunk=true",
"install-dependencies": "npm install && npm install ../../../../bin/node_modules/mi-diagnostics-0.0.1.tgz --no-save",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint"
},
"private": true,
"dependencies": {
"@angular/animations": "12.2.16",
"@angular/common": "12.2.16",
"@angular/compiler": "12.2.16",
"@angular/core": "12.2.16",
"@angular/forms": "12.2.16",
"@angular/platform-browser": "12.2.16",
"@angular/platform-browser-dynamic": "12.2.16",
"@angular/router": "12.2.16",
"@microsoft/signalr": "6.0.2",
"@shui/core": "1.14.0-hotfix2-ie.1",
"@types/d3": "^7.4.3",
"d3": "^7.8.5",
"d3-dag": "^1.1.0",
"rxjs": "~6.5.4",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.16",
"@angular-eslint/builder": "12.7.0",
"@angular-eslint/eslint-plugin": "12.7.0",
"@angular-eslint/eslint-plugin-template": "12.7.0",
"@angular-eslint/schematics": "12.7.0",
"@angular-eslint/template-parser": "12.7.0",
"@angular/cli": "~12.2.16",
"@angular/compiler-cli": "~12.2.0",
"@types/estree": "^1.0.0",
"@types/jasmine": "~3.8.0",
"@types/node": "^12.11.1",
"@types/d3": "^7.4.3",
"@typescript-eslint/eslint-plugin": "4.28.2",
"@typescript-eslint/parser": "4.28.2",
"eslint": "^7.26.0",
"jasmine-core": "~3.8.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"ts-node": "~8.3.0",
"typescript": "~4.3.5"
}
dag.comComponent.ts
Код: Выделить всё
import { Component, Input, OnChanges, OnInit, ViewEncapsulation } from '@angular/core';
import * as d3 from 'd3';
import * as d3dag from 'd3-dag';
import { IJobGraphNode, JobGraphNodeType } from './dag-data.model';
import { getNodeStateString, getNodeTypeString } from '../utils/dag-helpers';
import { initialData } from './dag-data';
@Component({
selector: 'app-dag-graph-viewer',
templateUrl: './dag-graph-viewer.component.html',
styleUrls: ['./dag-graph-viewer.component.scss'],
encapsulation: ViewEncapsulation.None,
})
export class DagGraphViewerComponent implements OnInit, OnChanges {
jgData: IJobGraphNode[] | null = null;
builder: d3dag.DefaultStratify;
nodeRadius = 20;
nodeSize = [this.nodeRadius * 2, this.nodeRadius * 2] as const;
zoom: any;
height: number = 0;
width: number = 0;
}
tsconfig.json
Код: Выделить всё
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"module": "es2020",
"moduleResolution": "node",
"experimentalDecorators": true,
"importHelpers": true,
"target": "es5",
"skipLibCheck": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
tsconfig.app.json
Код: Выделить всё
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"baseUrl": "../Client",
"module": "es2015",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
Когда я пытаюсь создать угловое приложение, я получаю сообщение об ошибке, как показано ниже:
Подробнее здесь:
https://stackoverflow.com/questions/781 ... pplication
1711620190
Anonymous
У меня запущено приложение Angular 12, и я установил d3 и d3-dag для создания графиков. Но я получаю ошибки в файле node_modules/d3-dag....index.d.ts. Версия Angular: 12.2.16 Версия Node.js: 14.16. 1 Версия d3: 7.8.5 Версия d3-dag: 1.1.0 [b]package.json[/b] [code]{ "name": "client", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "dev": "ng serve --proxy-config proxy.config.json --live-reload true", "build": "ng build --configuration production --aot --output-hashing none --vendor-chunk=true", "install-dependencies": "npm install && npm install ../../../../bin/node_modules/mi-diagnostics-0.0.1.tgz --no-save", "watch": "ng build --watch --configuration development", "test": "ng test", "lint": "ng lint" }, "private": true, "dependencies": { "@angular/animations": "12.2.16", "@angular/common": "12.2.16", "@angular/compiler": "12.2.16", "@angular/core": "12.2.16", "@angular/forms": "12.2.16", "@angular/platform-browser": "12.2.16", "@angular/platform-browser-dynamic": "12.2.16", "@angular/router": "12.2.16", "@microsoft/signalr": "6.0.2", "@shui/core": "1.14.0-hotfix2-ie.1", "@types/d3": "^7.4.3", "d3": "^7.8.5", "d3-dag": "^1.1.0", "rxjs": "~6.5.4", "tslib": "^2.0.0", "zone.js": "~0.11.4" }, "devDependencies": { "@angular-devkit/build-angular": "~12.2.16", "@angular-eslint/builder": "12.7.0", "@angular-eslint/eslint-plugin": "12.7.0", "@angular-eslint/eslint-plugin-template": "12.7.0", "@angular-eslint/schematics": "12.7.0", "@angular-eslint/template-parser": "12.7.0", "@angular/cli": "~12.2.16", "@angular/compiler-cli": "~12.2.0", "@types/estree": "^1.0.0", "@types/jasmine": "~3.8.0", "@types/node": "^12.11.1", "@types/d3": "^7.4.3", "@typescript-eslint/eslint-plugin": "4.28.2", "@typescript-eslint/parser": "4.28.2", "eslint": "^7.26.0", "jasmine-core": "~3.8.0", "karma": "~6.3.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.0.3", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "~1.7.0", "ts-node": "~8.3.0", "typescript": "~4.3.5" } [/code] [b]dag.comComponent.ts[/b] [code]import { Component, Input, OnChanges, OnInit, ViewEncapsulation } from '@angular/core'; import * as d3 from 'd3'; import * as d3dag from 'd3-dag'; import { IJobGraphNode, JobGraphNodeType } from './dag-data.model'; import { getNodeStateString, getNodeTypeString } from '../utils/dag-helpers'; import { initialData } from './dag-data'; @Component({ selector: 'app-dag-graph-viewer', templateUrl: './dag-graph-viewer.component.html', styleUrls: ['./dag-graph-viewer.component.scss'], encapsulation: ViewEncapsulation.None, }) export class DagGraphViewerComponent implements OnInit, OnChanges { jgData: IJobGraphNode[] | null = null; builder: d3dag.DefaultStratify; nodeRadius = 20; nodeSize = [this.nodeRadius * 2, this.nodeRadius * 2] as const; zoom: any; height: number = 0; width: number = 0; } [/code] [b]tsconfig.json[/b] [code]{ "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "downlevelIteration": true, "module": "es2020", "moduleResolution": "node", "experimentalDecorators": true, "importHelpers": true, "target": "es5", "skipLibCheck": true, "typeRoots": [ "node_modules/@types" ], "lib": [ "es2018", "dom" ] }, "angularCompilerOptions": { "fullTemplateTypeCheck": true, "strictInjectionParameters": true } } [/code] [b]tsconfig.app.json[/b] [code]{ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/app", "baseUrl": "../Client", "module": "es2015", "types": [] }, "files": [ "src/main.ts", "src/polyfills.ts" ], "include": [ "src/**/*.d.ts" ] } [/code] Когда я пытаюсь создать угловое приложение, я получаю сообщение об ошибке, как показано ниже: [img] [/img] Подробнее здесь: [url]https://stackoverflow.com/questions/78140150/how-to-fix-index-d-ts-error-of-d3-dag-while-building-angular-application[/url]