Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type '"token_separators"' is not assignable to type 'keyof CollectionCreateSchemaWithSrc'. #269

Open
StevenH86 opened this issue Feb 25, 2025 · 10 comments

Comments

@StevenH86
Copy link

Hi,

Since updating to 2.0.2 I can no longer compile due to the error below. Cannot figure out what is causing it. I've had to go with skipLibCheck in the meantime.

Any ideas?

"typescript": "~5.4.5"

[ng] Type '"token_separators"' is not assignable to type 'keyof CollectionCreateSchemaWithSrc'. [plugin angular-compiler] [ng] node_modules/typesense/lib/Typesense/Collection.d.ts:10:84: [ng] 10 │ ...ollectionCreateSchema, "token_separators" | "symbols_to_index">> {

Thanks

@tharropoulos
Copy link
Contributor

Could you give an example where that error occurs?

@StevenH86
Copy link
Author

@tharropoulos happens in terminal when trying to compile the app with ng serve.

I'm guessing it's some dependency conflict, but have no idea which one.

@tharropoulos
Copy link
Contributor

It should be a tsc error. Could you try running tsc against your app, and look for the line numbers in the trace

@StevenH86
Copy link
Author

StevenH86 commented Feb 25, 2025

@tharropoulos

node_modules/typesense/lib/Typesense/Collection.d.ts:10:85 - error TS2344: Type '"token_separators" | "symbols_to_index"' does not satisfy the constraint 'keyof CollectionCreateSchemaWithSrc'.
Type '"token_separators"' is not assignable to type 'keyof CollectionCreateSchemaWithSrc'.

10 export interface CollectionFieldSchema extends Partial<Pick<CollectionCreateSchema, "token_separators" | "symbols_to_index">> {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error in node_modules/typesense/lib/Typesense/Collection.d.ts:10

@tharropoulos
Copy link
Contributor

@tharropoulos

node_modules/typesense/lib/Typesense/Collection.d.ts:10:85 - error TS2344: Type '"token_separators" | "symbols_to_index"' does not satisfy the constraint 'keyof CollectionCreateSchemaWithSrc'.
Type '"token_separators"' is not assignable to type 'keyof CollectionCreateSchemaWithSrc'.

10 export interface CollectionFieldSchema extends Partial<Pick<CollectionCreateSchema, "token_separators" | "symbols_to_index">> {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error in node_modules/typesense/lib/Typesense/Collection.d.ts:10

Thanks, will take a look.

@StevenH86
Copy link
Author

@tharropoulos Thanks, appreciate it.

@tharropoulos
Copy link
Contributor

There don't seem to be any type errors in the library as of 2.0.2. Could you provide your tsconfig.json so I can replicate it?

@StevenH86
Copy link
Author

@tharropoulos

// tsconfig.json
{ "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, "module": "ES2022", "moduleResolution": "node", "importHelpers": true, "target": "ES2022", "lib": ["ES2022", "dom"], "resolveJsonModule": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, // "skipLibCheck": true, "useDefineForClassFields": false }, "angularCompilerOptions": { "fullTemplateTypeCheck": true, "strictInjectionParameters": true // "strictTemplates": true, }, "exclude": [ "scripts/**/*", "functions/**/*", "types/**/*" ] }

// tsconfig.app.json
{ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/app", "types": [] }, "files": ["src/main.ts", "src/polyfills.ts"], "include": ["src/**/*.ts", "src/**/*.d.ts"], "exclude": ["src/**/*.spec.ts", "src/test.ts", "src/**/*.prod.ts"] }

// tsconfig.spec.json
{ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/spec", "types": ["jasmine", "node"] }, "files": ["src/test.ts", "src/polyfills.ts", "src/zone-flags.ts"], "include": ["src/**/*.spec.ts", "src/**/*.d.ts"] }

@tharropoulos
Copy link
Contributor

The PR I posted should take care of this

@StevenH86
Copy link
Author

@tharropoulos awesome! That fixes it. Any idea when that will make its way into a released version?

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants