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

Fix .d.ts #22

Merged
merged 3 commits into from
Aug 19, 2020
Merged

Fix .d.ts #22

merged 3 commits into from
Aug 19, 2020

Conversation

tripodsgames
Copy link
Contributor

Module declaration did not work because index.d.ts is not a rootType, so I created a declaration file for each mode.

@lukeed
Copy link
Owner

lukeed commented Aug 19, 2020

Hmm may I ask for your settings / a repro? What's published currently is working on my end

@tripodsgames
Copy link
Contributor Author

Sure, I use typescript in a very strict mode

tsconfig.json:

{
    "compilerOptions": {
        "declaration": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "lib": [
            "ES2018"
        ],
        "module": "commonjs",
        "newLine": "LF",
        "esModuleInterop": true,
        "noFallthroughCasesInSwitch": true,
        "noImplicitAny": true,
        "noImplicitReturns": true,
        "noImplicitThis": true,
        "noUnusedParameters": true,
        "noUnusedLocals": true,
        "outDir": "dist",
        "sourceMap": true,
        "strictNullChecks": true,
        "target": "ES2018",
        "typeRoots": [
            "typings",
            "node_modules/@types"
        ]
    },
    "include": [
        "src/**/*.ts"
    ],
    "exclude": [
        "typings"
    ]
}

@tripodsgames
Copy link
Contributor Author

image
At compile time I'm getting this error.

@lukeed
Copy link
Owner

lukeed commented Aug 19, 2020

Thanks! I'll be back to my desk in a little bit and run through then.
I'm confused though since we're already doing exactly what the error message says to do

@tripodsgames
Copy link
Contributor Author

Thanks! I'll be back to my desk in a little bit and run through then.
I'm confused though since we're already doing exactly what the error message says to do

Me too, sometimes typescript is weird.

image
Inside the typings folder(typeRoots) it works...

@lukeed
Copy link
Owner

lukeed commented Aug 19, 2020

Oh. I just noticed your typeRoots config.
You are literally telling TS to ignore any other locations. Please see docs for this.

I recommend you move your typings directory, which I assume is your project's custom types, into src/@types or @types (root). You want to make use of the native resolution steps. Setting any value immediately disables normal lookup patterns

@tripodsgames
Copy link
Contributor Author

tripodsgames commented Aug 19, 2020

Oh. I just noticed your typeRoots config.
You are literally telling TS to ignore any other locations. Please see docs for this.

I recommend you move your typings directory, which I assume is your project's custom types, into src/@types or @types (root). You want to make use of the native resolution steps. Setting any value immediately disables normal lookup patterns

I'll try.
[Edit] Same error...

@lukeed
Copy link
Owner

lukeed commented Aug 19, 2020

I've run into this before -- was definitely annoying and unexpected 😅
Don't forget to remove that config once you've renamed your directory.

@tripodsgames
Copy link
Contributor Author

tripodsgames commented Aug 19, 2020

I've run into this before -- was definitely annoying and unexpected sweat_smile
Don't forget to remove that config once you've renamed your directory.

:(
I tested other configurations and they also failed, could you send your tsconfig for me to test?
If I test, pointing locally to the "fix" branch, it works perfectly...

@lukeed
Copy link
Owner

lukeed commented Aug 19, 2020

Shit – you're right! I've got some serious double-checking to do in my projects~

I want to make some adjustments to your PR(s) but let's get this in.

@tripodsgames
Copy link
Contributor Author

Shit – you're right! I've got some serious double-checking to do in my projects~

I want to make some adjustments to your PR(s) but let's get this in.

If you want, i can create a project in typescript(strict) for testing your libraries.

@lukeed
Copy link
Owner

lukeed commented Aug 19, 2020

Thanks :) I think my public stuff should be pretty easy to find & fix. I really meant my private things that followed the same pattern. Definitely feel free to open an issue on anything you see that I forgot though!

@lukeed lukeed merged commit 71f8415 into lukeed:master Aug 19, 2020
@lukeed
Copy link
Owner

lukeed commented Aug 19, 2020

These PRs inspired me to add type-definition management inside bundt.
Now, when a "mode" source file is built, bundt will copy its related *.d.ts file (if exists) into the proper directory.

I probably won't make use of it inside dequal/klona, since they just need the xargs | copy script, but everything else will definitely need it. 👍

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

Successfully merging this pull request may close these issues.

2 participants