pinecone-io / pinecone-ts-client

The official TypeScript/Node client for the Pinecone vector database
https://www.pinecone.io
Apache License 2.0
187 stars 37 forks source link

[Bug] v1.0.0 transpile errors #102

Closed GoncaloBastos closed 1 year ago

GoncaloBastos commented 1 year ago

Is this a new bug?

Current Behavior

When running npx tsc several errors occur.

Expected Behavior

Should transpile correctly.

Steps To Reproduce

  1. import v1.0.0
  2. try to transpile

Relevant log output

/@sinclair/typebox/typebox.d.ts:179:167 - error TS2589: Type instantiation is excessively deep and possibly infinite.

179 ] extends [TArray, TNumber] ? AssertType<T['items']> : K extends TTemplateLiteral ? TIndexReduce<T, TTemplateLiteralKeyRest<K>> : K extends TUnion<TLiteral<Key>[]> ? TIndexReduce<T, TUnionLiteralKeyRest<K>> : K extends TLiteral<Key> ? TIndexReduce<T, [K['const']]> : TNever;

```node_modules/@types/web/index.d.ts:7:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: NodeFilter, XPathNSResolver, SVGMatrix, WebKitCSSMatrix, SVGPoint, SVGRect, location, webkitURL, ImportExportKind, TableKind, ValueType, ExportValue, Exports, ImportValue, Imports, ModuleImports, ElementTagNameMap, name, AlgorithmIdentifier, BigInteger, BinaryData, BlobPart, BodyInit, BufferSource, COSEAlgorithmIdentifier, CSSKeywordish, CSSNumberish, CSSPerspectiveValue, CSSUnparsedSegment, CanvasImageSource, ClipboardItemData, ClipboardItems, ConstrainBoolean, ConstrainDOMString, ConstrainDouble, ConstrainULong, DOMHighResTimeStamp, EpochTimeStamp, EventListenerOrEventListenerObject, FileSystemWriteChunkType, Float32List, FormDataEntryValue, GLbitfield, GLboolean, GLclampf, GLenum, GLfloat, GLint, GLint64, GLintptr, GLsizei, GLsizeiptr, GLuint, GLuint64, HTMLOrSVGImageElement, HTMLOrSVGScriptElement, HashAlgorithmIdentifier, HeadersInit, IDBValidKey, ImageBitmapSource, Int32List, LineAndPositionSetting, MediaProvider, MessageEventSource, MutationRecordType, NamedCurve, OffscreenRenderingContext, OnBeforeUnloadEventHandler, OnErrorEventHandler, PerformanceEntryList, ReadableStreamController, ReadableStreamReadResult, ReadableStreamReader, RenderingContext, ReportList, RequestInfo, TexImageSource, TimerHandler, Transferable, Uint32List, VibratePattern, WindowProxy, XMLHttpRequestBodyInit, AlignSetting, AlphaOption, AnimationPlayState, AnimationReplaceState, AppendMode, AttestationConveyancePreference, AudioContextLatencyCategory, AudioContextState, AuthenticatorAttachment, AuthenticatorTransport, AutoKeyword, AutomationRate, AvcBitstreamFormat, BinaryType, BiquadFilterType, CSSMathOperator, CSSNumericBaseType, CanPlayTypeResult, CanvasDirection, CanvasFillRule, CanvasFontKerning, CanvasFontStretch, CanvasFontVariantCaps, CanvasLineCap, CanvasLineJoin, CanvasTextAlign, CanvasTextBaseline, CanvasTextRendering, ChannelCountMode, ChannelInterpretation, ClientTypes, CodecState, ColorGamut, ColorSpaceConversion, CompositeOperation, CompositeOperationOrAuto, CredentialMediationRequirement, DOMParserSupportedType, DirectionSetting, DisplayCaptureSurfaceType, DistanceModelType, DocumentReadyState, DocumentVisibilityState, EncodedVideoChunkType, EndOfStreamError, EndingType, FileSystemHandleKind, FillMode, FontDisplay, FontFaceLoadStatus, FontFaceSetLoadStatus, FullscreenNavigationUI, GamepadHapticActuatorType, GamepadHapticEffectType, GamepadHapticsResult, GamepadMappingType, GlobalCompositeOperation, HardwareAcceleration, HdrMetadataType, IDBCursorDirection, IDBRequestReadyState, IDBTransactionDurability, IDBTransactionMode, ImageOrientation, ImageSmoothingQuality, InsertPosition, IterationCompositeOperation, KeyFormat, KeyType, KeyUsage, LatencyMode, LineAlignSetting, LockMode, MIDIPortConnectionState, MIDIPortDeviceState, MIDIPortType, MediaDecodingType, MediaDeviceKind, MediaEncodingType, MediaKeyMessageType, MediaKeySessionClosedReason, MediaKeySessionType, MediaKeyStatus, MediaKeysRequirement, MediaSessionAction, MediaSessionPlaybackState, MediaStreamTrackState, NavigationTimingType, NotificationDirection, NotificationPermission, OffscreenRenderingContextId, OrientationLockType, OrientationType, OscillatorType, OverSampleType, PanningModelType, PaymentComplete, PermissionName, PermissionState, PlaybackDirection, PositionAlignSetting, PredefinedColorSpace, PremultiplyAlpha, PresentationStyle, PublicKeyCredentialType, PushEncryptionKeyName, RTCBundlePolicy, RTCDataChannelState, RTCDegradationPreference, RTCDtlsTransportState, RTCEncodedVideoFrameType, RTCErrorDetailType, RTCIceCandidateType, RTCIceComponent, RTCIceConnectionState, RTCIceGathererState, RTCIceGatheringState, RTCIceProtocol, RTCIceTcpCandidateType, RTCIceTransportPolicy, RTCIceTransportState, RTCPeerConnectionState, RTCPriorityType, RTCRtcpMuxPolicy, RTCRtpTransceiverDirection, RTCSctpTransportState, RTCSdpType, RTCSignalingState, RTCStatsIceCandidatePairState, RTCStatsType, ReadableStreamReaderMode, ReadableStreamType, ReadyState, RecordingState, ReferrerPolicy, RemotePlaybackState, RequestCache, RequestCredentials, RequestDestination, RequestMode, RequestRedirect, ResidentKeyRequirement, ResizeObserverBoxOptions, ResizeQuality, ResponseType, ScrollBehavior, ScrollLogicalPosition, ScrollRestoration, ScrollSetting, SecurityPolicyViolationEventDisposition, SelectionMode, ServiceWorkerState, ServiceWorkerUpdateViaCache, ShadowRootMode, SlotAssignmentMode, SpeechSynthesisErrorCode, TextTrackKind, TextTrackMode, TouchType, TransferFunction, UserVerificationRequirement, VideoColorPrimaries, VideoEncoderBitrateMode, VideoFacingModeEnum, VideoMatrixCoefficients, VideoPixelFormat, VideoTransferCharacteristics, WakeLockType, WebGLPowerPreference, WorkerType, WriteCommandType, XMLHttpRequestResponseType```

Environment

- **OS**: Windows 
- **Language version**: Node v18.17.1
- **Pinecone client version**: v1.0.0

Additional Context

No response

jhamon commented 1 year ago

Thanks for filing, I never saw this error while developing with typescript in our various sample apps. I need to do some investigation to understand what's going wrong, but if typebox ends up being problematic we can refactor away from it.

JoeCoppola-HIA commented 1 year ago

Thanks for the response @jhamon. If it helps, here is the tsconfig json we use:

  "compileOnSave": true,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./server-dist",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "noImplicitAny": false,
    "module": "commonjs",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "allowJs": true,
    "importHelpers": true,
    "target": "es2015",
    "lib": ["es2018", "dom"],
    "paths": {
      "@/*": ["src/*", "../shared/*"]
    }
  },
  "exclude": ["server-scripts", "pm2.config.js", "server-dist"]
}

And our project dependencies:

  "dependencies": {
    "@azure/arm-mediaservices": "^13.1.0",
    "@azure/identity": "^3.3.0",
    "@pinecone-database/pinecone": "^0.1.6",
    "axios": "^1.5.0",
    "body-parser": "^1.20.2",
    "cors": "^2.8.5",
    "dotenv": "^16.3.1",
    "express": "^4.18.2",
    "mime-types": "^2.1.35",
    "mssql": "^9.1.3",
    "nodemon": "^3.0.1",
    "path": "^0.12.7",
    "stytch": "^8.2.0",
    "uuid": "^9.0.0"
  },
  "devDependencies": {
    "@types/express": "^4.17.17",
    "@types/node": "^18.11.17",
    "tslib": "^2.6.1",
    "typescript": "^5.1.6"
  }
liljohnak commented 1 year ago

@jhamon In my firebase code I am also having an issue: https://stackoverflow.com/questions/77066529/problem-with-pinecone-in-firebase-functions

tsjson:

{
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "target": "es2017"
  },
  "compileOnSave": true,
  "include": [
    "src"
  ]
}

project dependencies:

"dependencies": {
    "@pinecone-database/pinecone": "^1.0.0",
    "firebase-admin": "^11.8.0",
    "firebase-functions": "^4.3.1",
    "openai": "^4.5.0"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.12.0",
    "@typescript-eslint/parser": "^5.12.0",
    "eslint": "^8.9.0",
    "eslint-config-google": "^0.14.0",
    "eslint-plugin-import": "^2.25.4",
    "firebase-functions-test": "^3.1.0",
    "typescript": "^4.9.0"
  }
liljohnak commented 1 year ago

@jhamon Repro if needed: pinecone_bug.zip

  1. unzip the following project folder and open with visual studio code
  2. npm install typescript
  3. npm install @pinecone-database/pinecone
  4. Ctrl+Shift+B
jhamon commented 1 year ago

Thanks everyone for the details. Will follow-up soon with a fix.

jhamon commented 1 year ago

I just published the 1.0.1 release with a lot of fixes for a variety of TypeScript issues. Release notes here. Please try it out and let me know if your install problems are resolved so I can close this issue.

Given the number of moving parts involved with Typescript it's still possible there are undetected issues. We'll have to continue expanding our compilation testing to cover these cases as they pop up.

liljohnak commented 1 year ago

@jhamon Compiles perfectly, big thanks.

jhamon commented 1 year ago

I'm going to close this issue as I believe a wide variety of common issues were resolved in PR #114 that shipped in 1.0.1. If you upgrade and still have compilation errors, please open a new ticket and I'll get to the bottom of it.

liljohnak commented 1 year ago

Perfect.