Skip to content

Fixed signature emit of getCloudinaryConfig#8

Merged
colbyfayock merged 1 commit intocloudinary-community:betafrom
Andarist:fix/getCloudinaryConfig-signature-emit
Sep 3, 2024
Merged

Fixed signature emit of getCloudinaryConfig#8
colbyfayock merged 1 commit intocloudinary-community:betafrom
Andarist:fix/getCloudinaryConfig-signature-emit

Conversation

@Andarist
Copy link
Contributor

@Andarist Andarist commented Sep 3, 2024

No description provided.

@vercel
Copy link

vercel bot commented Sep 3, 2024

@Andarist is attempting to deploy a commit to the Cloudinary DevX Team on Vercel.

A member of the Team first needs to authorize it.

*/

export function getCloudinaryConfig(config?: CloudinaryAssetConfiguration) {
export function getCloudinaryConfig(config?: ConfigOptions): ConfigOptions {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key here was to annotate the return type explicitly. Without it it tried to use the inferred type and the signature it got was:

function getCloudinaryConfig(config?: ConfigOptions): {
    cloud: {
        apiKey: any;
        cloudName: any;
        apiSecret?: string;
        authToken?: CloudinaryAssetConfigurationAuthToken;
    };
    url: {
        ...;
    };
} & CloudinaryConfigurationOptions

As we can see, this contains references to types like CloudinaryAssetConfigurationAuthToken (and probably some other ones that were ellided with ...). This wasn't accessible.

We could make those types accessible from within this module and the emit could succeed. I doubt you need that signature though. The simple one I'm proposing should be enough. It likely should stay opaque for the user what exact properties were made available on this return type through Object.assign etc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes total sense! thank you for explaining this

Comment on lines +4 to +6
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to those you'll see those errors earlier, in the IDE. Since you were disabling the declaration emit here... it had no chance to error in the IDE and it could only error when u actually tried to emit this using tsup

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha thanks! ill make sure all projects have this fix as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that if u are developing a deployable app you don't need this, in those contexts u don't care about dts emit so it's OK to not have those settings

"@semantic-release/git": "^10.0.1",
"semantic-release": "^23.0.0"
"semantic-release": "^23.0.0",
"typescript": "^5.5.4"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it a good practice to keep typescript as the root's dev dep. It makes it possible to select the installed TS version in VS Code through "Select TypeScript Version...". If you don't do that VS Code sticks to its pre-installed TS version and that can lead to weird discrepancies between the IDE and tsc

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should i then remove the TS dependency from the packages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont recall now what are the exact rules behind pnpm's lookup for executables. You could try removing it from packages and try executing pnpm run tsc from a package to see what happens. If it succeeds then it's likely OK to remove typescript dependency from ur packages. I usually keep it defined everywhere but it might be mostly out of habit ;p

@vercel
Copy link

vercel bot commented Sep 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
astro-cloudinary ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 3, 2024 3:12pm

@colbyfayock colbyfayock merged commit 51e7a36 into cloudinary-community:beta Sep 3, 2024
github-actions bot pushed a commit that referenced this pull request Sep 3, 2024
# [1.0.0-beta.10](v1.0.0-beta.9...v1.0.0-beta.10) (2024-09-03)

### Bug Fixes

* Merge pull request [#8](#8) from Andarist/fix/getCloudinaryConfig-signature-emit ([51e7a36](51e7a36))
@github-actions
Copy link

github-actions bot commented Sep 3, 2024

🎉 This PR is included in version 1.0.0-beta.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

colbyfayock added a commit to cloudinary-community/next-cloudinary that referenced this pull request Sep 13, 2024
# Description

Updates the TypeScript types to pull in `textTracks` to the
CldVideoPlayer component, which opens up the ability to add captions and
subtitles to videos.

This was technically already possible, as the option would be passed to
the player, but the types may have prevented it.

Usage:

```
textTracks={{
  captions: {
      label: 'English',
      language: 'en',
      default: true,
      url: 'https://res.cloudinary.com/<Cloud Name>/raw/upload/<FileName>.vtt'
    }
  }
}}
```

This also pulls in changes to `getCldImageUrl` which adds a version
number by default (v1). This is to improve the compatibility of
`getCldImageUrl` with the parsing capabilities that require a version
number.

Finally made a few TS config tweaks pulled over from:
cloudinary-community/astro-cloudinary#8

## Issue Ticket Number

Fixes #430 
Fixes #515 

<!-- Specify above which issue this fixes by referencing the issue
number (`#<ISSUE_NUMBER>`) or issue URL. -->
<!-- Example: Fixes
https://github.com/cloudinary-community/next-cloudinary/issues/<ISSUE_NUMBER>
-->

## Type of change

<!-- Please select all options that are applicable. -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Fix or improve the documentation
- [ ] This change requires a documentation update


# Checklist

<!-- These must all be followed and checked. -->

- [ ] I have followed the contributing guidelines of this project as
mentioned in [CONTRIBUTING.md](/CONTRIBUTING.md)
- [ ] I have created an
[issue](https://github.com/cloudinary-community/next-cloudinary/issues)
ticket for this PR
- [ ] I have checked to ensure there aren't other open [Pull
Requests](https://github.com/cloudinary-community/next-cloudinary/pulls)
for the same update/change?
- [ ] I have performed a self-review of my own code
- [ ] I have run tests locally to ensure they all pass
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes needed to the documentation
colbyfayock added a commit that referenced this pull request Sep 18, 2024
# 1.0.0-beta.1 (2024-07-30)

### Features

* CldImage ([34ce9a1](34ce9a1))

* adding more cldimage capabilities and error handling

* feat: organization, cldvideoplayer

* feat: organization, cldvideoplayer

* chore(release): 1.0.0-beta.2 [skip ci]

# [1.0.0-beta.2](v1.0.0-beta.1...v1.0.0-beta.2) (2024-08-05)

### Features

* organization, cldvideoplayer ([e1174dc](e1174dc))
* organization, cldvideoplayer ([605608b](605608b))

* feat: fixing included props, updating docs

* feat: fixing included props, updating docs

* updating pnpm lock

* chore(release): 1.0.0-beta.3 [skip ci]

# [1.0.0-beta.3](v1.0.0-beta.2...v1.0.0-beta.3) (2024-08-07)

### Features

* fixing included props, updating docs ([a3c361d](a3c361d))
* fixing included props, updating docs ([a85aab7](a85aab7))

* removing package lock

* docs updates, script for contributing

* docs: cldimage examples and docs

* cldvideoplayer basic usage

* cldvideoplayer docs and config

* cldvideoplayer docs and config

* cldvideoplayer examples

* responsive sizing guide

* setting up global event listener for CldImage errors

* feat: docs, helpers seed

* chore(release): 1.0.0-beta.4 [skip ci]

# [1.0.0-beta.4](v1.0.0-beta.3...v1.0.0-beta.4) (2024-08-22)

### Features

* docs, helpers seed ([58f8474](58f8474))

* feat: adding prepare script to run build

* chore(release): 1.0.0-beta.5 [skip ci]

# [1.0.0-beta.5](v1.0.0-beta.4...v1.0.0-beta.5) (2024-08-22)

### Features

* adding prepare script to run build ([4127fed](4127fed))

* beta version

* feat: adding and fixing helpers exports

* chore(release): 1.0.0-beta.6 [skip ci]

# [1.0.0-beta.6](v1.0.0-beta.5...v1.0.0-beta.6) (2024-08-23)

### Features

* adding and fixing helpers exports ([6743e18](6743e18))

* docs: adding docs for helper functions

* docs: beta 6

* fix: fixes props being read to include quality and others not included

* chore(release): 1.0.0-beta.7 [skip ci]

# [1.0.0-beta.7](v1.0.0-beta.6...v1.0.0-beta.7) (2024-08-28)

### Bug Fixes

* fixes props being read to include quality and others not included ([cf8bfe9](cf8bfe9))

* docs: installation version

* uses pollForProcessing from util library, updates url loader to get preserveTransformations support

* feat: adding an astro loader for content collections

* feat: adding an astro loader for content collections

* chore(release): 1.0.0-beta.8 [skip ci]

# [1.0.0-beta.8](v1.0.0-beta.7...v1.0.0-beta.8) (2024-08-29)

### Features

* adding an astro loader for content collections ([ba670a3](ba670a3))
* adding an astro loader for content collections ([75e3fd2](75e3fd2))

* docs: installation # bump

* adding paginated requests and examples

* adding paginated requests and examples

* feat: updating types and org

* feat: updating types and org

* chore(release): 1.0.0-beta.9 [skip ci]

# [1.0.0-beta.9](v1.0.0-beta.8...v1.0.0-beta.9) (2024-08-30)

### Features

* updating types and org ([7abcafc](7abcafc))
* updating types and org ([1837bf7](1837bf7))

* docs: beta version in install

* docs: fixing loaders url

* docs: wording

* Fixed signature emit of `getCloudinaryConfig`

* chore(release): 1.0.0-beta.10 [skip ci]

# [1.0.0-beta.10](v1.0.0-beta.9...v1.0.0-beta.10) (2024-09-03)

### Bug Fixes

* Merge pull request [#8](#8) from Andarist/fix/getCloudinaryConfig-signature-emit ([51e7a36](51e7a36))

* fix: updating assets loader to use public_id for easier querying, adding getentry example to docs

* chore(release): 1.0.0-beta.11 [skip ci]

# [1.0.0-beta.11](v1.0.0-beta.10...v1.0.0-beta.11) (2024-09-05)

### Bug Fixes

* updating assets loader to use public_id for easier querying, adding getentry example to docs ([e535dea](e535dea))

* isntallation number in docs

* fix: updating types to fix resources in content loader

* updating install version

* chore(release): 1.0.0-beta.12 [skip ci]

# [1.0.0-beta.12](v1.0.0-beta.11...v1.0.0-beta.12) (2024-09-05)

### Bug Fixes

* updating types to fix resources in content loader ([46bb682](46bb682))

* fix: updating types for accurate definitions

* chore(release): 1.0.0-beta.13 [skip ci]

# [1.0.0-beta.13](v1.0.0-beta.12...v1.0.0-beta.13) (2024-09-07)

### Bug Fixes

* updating types for accurate definitions ([dc9e3b9](dc9e3b9))

* install beta #

* updating asset loader type exports

* feat: adding ability to opt into metdata and custom context for assets loader, adding new example

* docs: updating config docs for asset loader fields

* chore(release): 1.0.0-beta.14 [skip ci]

# [1.0.0-beta.14](v1.0.0-beta.13...v1.0.0-beta.14) (2024-09-11)

### Features

* adding ability to opt into metdata and custom context for assets loader, adding new example ([7f22e4e](7f22e4e))

* updating name of assetType for cldAssetsLoader to resourceType for consistency

* updating name of assetType for cldAssetsLoader to resourceType for consistency

* docs: version isntall

* fix: adding keywords to package.json

* chore(release): 1.0.0-beta.15 [skip ci]

# [1.0.0-beta.15](v1.0.0-beta.14...v1.0.0-beta.15) (2024-09-13)

### Bug Fixes

* adding keywords to package.json ([0969c5d](0969c5d))

* fixing types for cloudinary resources

* comprehensive docs updates, fixing and adding upload widget

* docs: favicon

* docs: vercel

* feat: force bump

* chore(release): 1.0.0-beta.16 [skip ci]

# [1.0.0-beta.16](v1.0.0-beta.15...v1.0.0-beta.16) (2024-09-18)

### Features

* force bump ([3cf26d1](3cf26d1))

---------

Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
@colbyfayock
Copy link
Collaborator

@all-contributors please add @Andarist for code

@allcontributors
Copy link
Contributor

@colbyfayock

I've put up a pull request to add @Andarist! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants