import { ParseFilePipe } from '#nestjs/common';
'"#nestjs/common"' has no exported member named 'ParseFilePipe'. Did you mean 'ParseFloatPipe'?
The docs say all pipes are in /common.
yarn add #nestjs/common
Looks like the install was corrupted for me. All other pipes worked but not this one, very unsettling.
It's not mentioned in the docs, but these are only available in NestJS 9.x.
Related
I'd like to import the Schema$ListMessagesResponse interface so I can validate the response that's returned.
I tried import { google, Schema$ListMessagesResponse } from 'googleapis'; but that doesn't work. I'm not familiar with importing this object from the package. It's documented here and here - How do I properly reference it?
https://googleapis.dev/nodejs/googleapis/latest/gmail/interfaces/Schema$Message.html
Node v12
TypeScript 4.3.5
You need to respect the given namespace gmail_v1 exporting the interface
try:
import {gmail_v1} from 'googleapis';
const messages: gmail_v1.Schema$ListMessagesResponse = //...
trying to use passport-custom and the very first line, from pseudocode at npmjs, errors out:
import passportCustom from 'passport-custom';
The is no default import in index.js when I open it up under node_modules/passport-custom/lib
I must be missing something fundamental here, don't know what though
Try to use CommonJS const passportCustom = require("passport-custom") You probably have older version of Node.js which does not support ES6 modules.
There is no default export. So you will have to name the items you want to import (put them in curly braces).
//Example:
import { a,b,c,d} from 'youPackage';
//Your case:
import { passportCustom } from 'passport-custom';
Above are called named imports. When a package exports one item by default using: export default passportCustom ;, you could have use your code. You can access the code of the package to have a look for yourself.
I am trying to use a nodejs library like uuid in my typescript app. This simple import works just fine if I want to only use it in a specific class:
import { v4 } from "uuid";
class MyClass {
...
}
However, this makes the class MyClass not "discoverable" by any other files in my solution. Sure I could export it, but that forces me to import the class in every usage, and the problem spreads like a cancer to every file. Do I really have to import/export every single class/file in my application just because I want to produce a simple UUID?
I saw that I can use require instead, however typescript doesn't know what that keyword is. I found this question but neither installing #types/node nor the quick and dirty declare var require any works.
It really seems like I am jumping through a lot of unnecessary hoops just to generate a uuid in typescript. Am I doing something very wrong?
Thanks
Can anybody please help me figuring this out. The code fragment below runs in a NodeJS Typescript environment en this works fine on multiple machines across multiple platforms but fails to build on CircleCI with the following:
error TS2339: Property 'fromPromise' does not exist on type 'typeof Observable'.
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/frompromise';
import 'rxjs/add/operator/do';
return Observable.fromPromise(col.insertOne(document))
What is different in the CircleCI environment that causes this and what would be a solution?
With RxJS 5.5+, the Observable prototype does not include any static methods. For this reason, you will need to take one of two approaches to include the fromPromise (and other) static methods.
RxJS v5.5.2 is the default dependency version for Angular 5.
Approach 1 (preferred option)
To use the fromPromise method, independently import it from rxjs/observable.
import { fromPromise } from 'rxjs/observable/fromPromise';
let observable = fromPromise(promise);
This approach is beneficial for reducing the bundle size, as it will import only what you need by patching the Observable prototype.
Approach 2 (unoptimized approach)
To use the static Observable.fromPromise as you previously have, you will need to import Observable from rxjs/Rx.
import Rx from 'rxjs/Rx';
This method will import the entire core set of functionality, resulting in a larger bundle size.
OK, it must not be my day. The problem was the capital 'P' in the import statement.
import 'rxjs/add/observable/fromPromise';
This is no problem on platforms with a case insensitive filesystem so I didn't notice it on Mac OS/X and also not on Windows. but CircleCI uses Linux.
I have the following reference import { STORE } from "../data/store"; It's part of a react project and works as expected.
However I need to run some code separately over STORE and accessed it the same way as it is in the react project, but ran via ts-node. When I try to access STORE by let data = STORE[videoId].labels;, with videoId set as "home" I get TypeError: Cannot read property 'home' of undefined.
Might anyone know what I'm missing --- must be something specific to ts-node...? Thanks!
In case someone arrives on this page because of imports issue, like I did, here's what my problem was:
I had three files : index.ts, File.json and File.ts
In index.ts:
import { thing } from "./File";
was working well in VS Code: I had auto-completion for thing and everything.
But when running ts-node index.ts, thing was undefined!
When I remembered that I had the json file, I just renamed File.ts to File.module.ts and changed the import to:
import { thing } from "./File.module";
and it was sorted.
It sounds like the property STORE is undefined..
If you change import { STORE } from "../data/store"; to import * as STORE from "../data/store" does it work?