반응형

TypeScript 16

웹 스트림과 Node.js 스트림 API의 차이점

웹 스트림과 Node.js 스트림 API의 차이점 스트림 개념에 익숙해지기 위해 파일 업로드 애플리케이션을 구축하고 있습니다.파일 목록 또는 블롭을 스트림으로 변환한 다음 백엔드에 업로드하여 파일 시스템에 저장하려고 합니다. 프런트엔드와 백엔드 구현에는 각각 문제가 없었지만 두 구현을 연결하는 데 어려움을 겪고 있습니다.저의 주된 문제는 웹 스트림 API와 Node.js 스트림 API의 차이점을 이해하지 못한다는 것입니다.브라우저에서 선택한 입력 파일의 블롭을 웹으로 변환하는 데 성공했습니다.ReadableStream하지만 내가 시도한 패키지들(axios요청의 경우,socket.io그리고.socket.io-streamWebSocket의 경우) Node.js 버전 스트림만 인수로 허용합니다.또한 WebRe..

prosource 2023.07.02

유형 스크립트 확장 서드 파티 선언 파일

유형 스크립트 확장 서드 파티 선언 파일 타사 선언 파일을 확장하려면 어떻게 해야 합니까? 예를 들어, 나는 확장하고 싶습니다.Context@types/koa에서 필드를 추가합니다(resource) 그것으로. 시도해 봤습니다. // global.d.ts declare namespace koa { interface Context { resource: any; } } 하지만 효과가 없습니다. error TS2339: Property 'resource' does not exist on type 'Context'. 갱신하다 다음 오류가 발생하는 내 코드의 단순화된 버전: import {Context} from 'koa'; import User from './Models/User'; class Controller..

prosource 2023.07.02

매트-소트-헤더를 사용하여 날짜 문자열별로 정렬하는 방법은 무엇입니까?

매트-소트-헤더를 사용하여 날짜 문자열별로 정렬하는 방법은 무엇입니까? 사건 테이블은 다음과 같이 구성되어 있습니다.angular.material날짜별 정렬을 추가해야 합니다.하지만 내 데이트 상대는string유형을 입력하여 정렬이 잘못되었습니다.기본값을 재정의하는 방법mat-sort-header행동.그리고 가능합니까? Reg Date {{element.regDate}} TS 측에서는: sort: MatSort; @ViewChild(MatSort) set appBacon(sort : MatSort) { this.sort = sort; this.dataSource.sort = this.sort; } dataSource = new MatTableDataSource([]); 해결 방법은 다음과 같습니다. - ..

prosource 2023.06.27

각도: 매트 양식 필드에는 매트 양식 필드 컨트롤이 포함되어야 합니다.

각도: 매트 양식 필드에는 매트 양식 필드 컨트롤이 포함되어야 합니다. 사용자 지정 전화번호 입력 컨트롤이 있는 양식 필드를 추가하려고 합니다.저는 https://material.angular.io/components/form-field/examples 의 전화기의 예를 사용했습니다. 코드는 다음과 같습니다. phone Include area code import {FocusMonitor} from '@angular/cdk/a11y'; import {coerceBooleanProperty} from '@angular/cdk/coercion'; import {Component, ElementRef, Input, OnDestroy} from '@angular/core'; import {FormBuilder,..

prosource 2023.06.22

Typescript 및 Jest를 사용한 단순 가져오기 모의

Typescript 및 Jest를 사용한 단순 가져오기 모의 유형 스크립트를 사용하여 가져오기를 조롱하는 가장 쉬운 방법은 무엇입니까? 저는 아래와 같이 간단한 것을 하고 싶습니다.그러나 Typescript는 전체 가져오기 개체에 대한 정의와 일치하지 않는다고 말합니다. Type 'Mock, []>' is not assignable to type '(input: RequestInfo, init?: RequestInit | undefined) => Promise'. Type 'Promise Promise; }>' is not assignable to type 'Promise'. Type '{ json: () => Promise; }' is missing the following properties from..

prosource 2023.06.17

Angular 5 - 브라우저 새로 고침 시 홈페이지로 페이지 리디렉션

Angular 5 - 브라우저 새로 고침 시 홈페이지로 페이지 리디렉션 현재 다음과 같은 경로에서 페이지를 새로 고칠 때 http://localhost:4200/http 같은 경로를 유지합니다.하지만 그 경로가 다음으로 리디렉션되길 바랍니다. http://localhost:4200 저는 사람들이 같은 경로를 유지하기 위해 어떻게 새로 고침을 시행하는지 문의하는 것을 보았습니다.그래서 기본 각도는 브라우저 새로 고침 시 홈페이지로 리디렉션되어야 할 것 같습니다.제 각진 디폴트 프로젝트가 왜 이것을 다르게 하는지 아십니까? 아래는 내 AppRouting 모듈입니다. import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '..

prosource 2023.06.12

해결 방법:Node.js를 실행하는 데 사용 중인 현재 플랫폼에서 재귀적으로 기능 감시를 사용할 수 없습니다.

해결 방법:Node.js를 실행하는 데 사용 중인 현재 플랫폼에서 재귀적으로 기능 감시를 사용할 수 없습니다. 도커 컨테이너에서 typescript express.js를 실행하려고 합니다.도커를 실행한 후 다음 오류가 발생합니다. > ts-node-dev src/app.ts Using ts-node version 8.10.1, typescript version 3.9.2 TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js at Object.watch (fs.js:1441:11) at ..

prosource 2023.06.12

도달 가능성 분석에서 Promise가 고려되지 않는 이유는 무엇입니까?

도달 가능성 분석에서 Promise가 고려되지 않는 이유는 무엇입니까? 다음과 같은 기능이 있다고 가정합니다. function returnNever(): never { throw new Error(); } IIF를 생성할 때 다음 코드는 도달 불가능으로 표시됩니다. (async () => { let b: string; let a0 = returnNever(); b = ""; // Unreachable b.toUpperCase(); // Unreachable })(); 이것은 예상대로 작동합니다.참고:a0유형으로 추정됩니다.never. 하지만, 만약에returnNever()를 반환합니다.Promise기다리고 있으면 행동이 달라집니다. (async () => { let b: string; let a1 = a..

prosource 2023.06.12

Angular 6의 multi ./styles.css에 오류가 있습니다.

Angular 6의 multi ./styles.css에 오류가 있습니다. 저는 Angular 6에 처음 왔습니다. 제 프로젝트에서 아래 오류가 발생했습니다. ERROR in multi ./node_modules/bootstrap/dist/css/bootstrap.min.css ./styles.css Module not found: Error: Can't resolve 'C:\Users\User\e-CommerceWebsite\styles.css' in 'C:\Users\User\e-CommerceWebsite' 그리고 브라우저가 표시됩니다. cannot Get 각진.json "styles": [ "./node_modules/bootstrap/dist/css/bootstrap.min.css", "style..

prosource 2023.06.07

스크립트 + 스크립트에서 변수의 유형을 확인하는 방법은 무엇입니까?

스크립트 + 스크립트에서 변수의 유형을 확인하는 방법은 무엇입니까? typescript + angular 변수의 유형을 확인하는 방법을 알려주시겠습니까? import { Component } from '@angular/core'; interface Abc { name : string } @Component({ selector: 'my-app', templateUrl: './app.component.html', styleUrls: [ './app.component.css' ] }) export class AppComponent { name = 'Angular 6'; a:Abc= { name:"sss" } constructor(){ console.log(typeof this.a) // console.log(..

prosource 2023.06.07
반응형