-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Typescript typings #66
Comments
Could you provide some more context? |
Haven't heard anything back so I'm gonna close this. If it does still need to be fixed, we can open the issue back up when we have more information. |
@oyejorge We face the same issue. We want only use the typings, but we actually can only use the In the Same for https://github.com/orchidjs/sifter.js I tried a bit here is a patch: diff --git a/.config/tsconfig.types.json b/.config/tsconfig.types.json
new file mode 100644
index 00000000..7f05c65c
--- /dev/null
+++ b/.config/tsconfig.types.json
@@ -0,0 +1,17 @@
+{
+ "include": ["../src/**/*"],
+ "compilerOptions": {
+ "allowJs": true,
+ "checkJs": true,
+ "strict": true,
+ "target": "esnext",
+ "module": "esnext",
+ "noUnusedLocals": true,
+
+ "declaration": true,
+ "declarationDir": "../dist/types",
+ "emitDeclarationOnly": true,
+ "isolatedModules": true,
+ "moduleResolution": "node"
+ },
+}
diff --git a/Gruntfile.js b/Gruntfile.js
index 7f904d4d..01c7e9a5 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -23,6 +23,7 @@ module.exports = function(grunt) {
'clean:library',
'shell:buildjs',
+ 'shell:buildtypes',
'copy:scss',
'copy:scss_plugins',
@@ -299,6 +300,9 @@ module.exports = function(grunt) {
buildjs: {
command: 'npx rollup -c .config/rollup.config.js',
},
+ buildtypes: {
+ command: 'npx tsc --build .config/tsconfig.types.json',
+ },
},
watch: {
diff --git a/package.json b/package.json
index 4dad6aa2..1584c5ee 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
"main": "dist/js/tom-select.complete.js",
"browser": "dist/js/tom-select.complete.js",
"module": "dist/esm/tom-select.complete.js",
- "types": "src/tom-select.complete.ts",
+ "types": "dist/types/tom-select.complete.d.ts",
"description": "Tom Select is a versatile and dynamic <select> UI control. Forked from Selectize.js to provide a framework agnostic autocomplete widget with native-feeling keyboard navigation, it's useful for tagging, contact lists, country selectors, etc.",
"homepage": "https://tom-select.js.org",
"version": "1.7.6",
@@ -87,6 +87,7 @@
},
"scripts": {
"build": "grunt build",
+ "build:types": "tsc --build ./.config/tsconfig.types.json",
"test": "karma start",
"test:one": "karma start --test_one",
"test:typescript": "tsc -p .config --noemit",
|
This is very similar to a setup a tried earlier. However, I ran into a problem where it didn't emit the types already defined in /src/types. However, I may have just found the missing piece. |
Ok, should be fixed with 1.7.7 |
I'm trying to use the TypeScript typings as well, but I'm a bit stuck. I have some external js theme that automatically creates TomSelect instances so that is fine. But in some project related ts file I want to access this TomSelect instance like:
and then attach e.g.:
this works, but it does not recognise the Is there something I could to use TomSelect typings this way? ==== I for example also use Bootstrap-Table and there I have typings.
here it recognises the |
Describe the bug
Typescript is unable to recognize typings in present in the package.
To Reproduce
in app.ts
import TomSelect from 'tom-select
Expected behavior
It should be able to resolve type completions.
The text was updated successfully, but these errors were encountered: