Skip to content

'CFBundleTypeRole' does not exist in type 'URLScheme' #260

@sultanmyrza

Description

@sultanmyrza

Summary

The TypeScript definition for URLScheme in expo/config-plugins does not include CFBundleTypeRole, which causes a TypeScript error when trying to add this property to the CFBundleURLTypes array in Info.plist.

image

Config Plugin

@config-plugins/apple-settings

What platform(s) does this occur on?

iOS

SDK Version

~52.0.17

Reproducible demo

Follow untill this step Create an app.plugin.js file in the root directory

paste into plugin/src/index.ts

import {
  ConfigPlugin,
  createRunOncePlugin,
  withInfoPlist,
} from "expo/config-plugins";

// Get the package.json version and name
const pkg = require("../../package.json");

const withLineSDK: ConfigPlugin = (config) => {
  // Use withInfoPlist to modify the Info.plist file
  return withInfoPlist(config, (config) => {
    // Get the existing Info.plist
    const infoPlist = config.modResults;

    // Add CFBundleURLTypes if it doesn't exist
    if (!Array.isArray(infoPlist.CFBundleURLTypes)) {
      infoPlist.CFBundleURLTypes = [];
    }

    // Add LINE URL scheme configuration
    infoPlist.CFBundleURLTypes.push({
      CFBundleTypeRole: "Editor", // Error 'CFBundleTypeRole' does not exist in type 'URLScheme'.
      CFBundleURLSchemes: [
        `line3rdp.${config.ios?.bundleIdentifier || "$(PRODUCT_BUNDLE_IDENTIFIER)"}`,
      ],
    });

    return config;
  });
};

export default createRunOncePlugin(withLineSDK, pkg.name, pkg.version);

You will get 'CFBundleTypeRole' does not exist in type 'URLScheme'.

image

I use @ts-ignore as a workaround but can we have CFBundleTypeRole in URLScheme?

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions